1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Refactored some operators in Time and RelativeTime, and made the Time constructor explicit.

This commit is contained in:
Julian Storer 2010-12-21 18:22:05 +00:00
parent 968d63bca6
commit ece4205d3d
24 changed files with 421 additions and 540 deletions

View file

@ -35,7 +35,7 @@ class QuickTimeWindowWithFileBrowser : public Component,
public: public:
QuickTimeWindowWithFileBrowser() QuickTimeWindowWithFileBrowser()
: fileChooser ("movie", File::nonexistent, true, false, false, : fileChooser ("movie", File::nonexistent, true, false, false,
"*.*", String::empty, "(choose a video file to play)") "*", String::empty, "(choose a video file to play)")
{ {
addAndMakeVisible (&qtComp); addAndMakeVisible (&qtComp);

View file

@ -915,7 +915,7 @@ protected:
#include <GLUT/glut.h> #include <GLUT/glut.h>
#endif #endif
#if ! (CGFLOAT_DEFINED || defined (DOXYGEN)) #if ! CGFLOAT_DEFINED
#define CGFloat float #define CGFloat float
#endif #endif
@ -1492,60 +1492,18 @@ RelativeTime::~RelativeTime() throw()
{ {
} }
const RelativeTime RelativeTime::milliseconds (const int milliseconds) throw() const RelativeTime RelativeTime::milliseconds (const int milliseconds) throw() { return RelativeTime (milliseconds * 0.001); }
{ const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) throw() { return RelativeTime (milliseconds * 0.001); }
return RelativeTime (milliseconds * 0.001); const RelativeTime RelativeTime::minutes (const double numberOfMinutes) throw() { return RelativeTime (numberOfMinutes * 60.0); }
} const RelativeTime RelativeTime::hours (const double numberOfHours) throw() { return RelativeTime (numberOfHours * (60.0 * 60.0)); }
const RelativeTime RelativeTime::days (const double numberOfDays) throw() { return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0)); }
const RelativeTime RelativeTime::weeks (const double numberOfWeeks) throw() { return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0)); }
const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) throw() int64 RelativeTime::inMilliseconds() const throw() { return (int64) (seconds * 1000.0); }
{ double RelativeTime::inMinutes() const throw() { return seconds / 60.0; }
return RelativeTime (milliseconds * 0.001); double RelativeTime::inHours() const throw() { return seconds / (60.0 * 60.0); }
} double RelativeTime::inDays() const throw() { return seconds / (60.0 * 60.0 * 24.0); }
double RelativeTime::inWeeks() const throw() { return seconds / (60.0 * 60.0 * 24.0 * 7.0); }
const RelativeTime RelativeTime::minutes (const double numberOfMinutes) throw()
{
return RelativeTime (numberOfMinutes * 60.0);
}
const RelativeTime RelativeTime::hours (const double numberOfHours) throw()
{
return RelativeTime (numberOfHours * (60.0 * 60.0));
}
const RelativeTime RelativeTime::days (const double numberOfDays) throw()
{
return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0));
}
const RelativeTime RelativeTime::weeks (const double numberOfWeeks) throw()
{
return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0));
}
int64 RelativeTime::inMilliseconds() const throw()
{
return (int64) (seconds * 1000.0);
}
double RelativeTime::inMinutes() const throw()
{
return seconds / 60.0;
}
double RelativeTime::inHours() const throw()
{
return seconds / (60.0 * 60.0);
}
double RelativeTime::inDays() const throw()
{
return seconds / (60.0 * 60.0 * 24.0);
}
double RelativeTime::inWeeks() const throw()
{
return seconds / (60.0 * 60.0 * 24.0 * 7.0);
}
const String RelativeTime::getDescription (const String& returnValueForZeroTime) const const String RelativeTime::getDescription (const String& returnValueForZeroTime) const
{ {
@ -1553,65 +1511,63 @@ const String RelativeTime::getDescription (const String& returnValueForZeroTime)
return returnValueForZeroTime; return returnValueForZeroTime;
String result; String result;
result.preallocateStorage (16);
if (seconds < 0) if (seconds < 0)
result = "-"; result << '-';
int fieldsShown = 0; int fieldsShown = 0;
int n = abs ((int) inWeeks()); int n = std::abs ((int) inWeeks());
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" week ") result << n << (n == 1 ? TRANS(" week ")
: TRANS(" weeks ")); : TRANS(" weeks "));
++fieldsShown; ++fieldsShown;
} }
n = abs ((int) inDays()) % 7; n = std::abs ((int) inDays()) % 7;
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" day ") result << n << (n == 1 ? TRANS(" day ")
: TRANS(" days ")); : TRANS(" days "));
++fieldsShown; ++fieldsShown;
} }
if (fieldsShown < 2) if (fieldsShown < 2)
{ {
n = abs ((int) inHours()) % 24; n = std::abs ((int) inHours()) % 24;
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" hr ") result << n << (n == 1 ? TRANS(" hr ")
: TRANS(" hrs ")); : TRANS(" hrs "));
++fieldsShown; ++fieldsShown;
} }
if (fieldsShown < 2) if (fieldsShown < 2)
{ {
n = abs ((int) inMinutes()) % 60; n = std::abs ((int) inMinutes()) % 60;
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" min ") result << n << (n == 1 ? TRANS(" min ")
: TRANS(" mins ")); : TRANS(" mins "));
++fieldsShown; ++fieldsShown;
} }
if (fieldsShown < 2) if (fieldsShown < 2)
{ {
n = abs ((int) inSeconds()) % 60; n = std::abs ((int) inSeconds()) % 60;
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" sec ") result << n << (n == 1 ? TRANS(" sec ")
: TRANS(" secs ")); : TRANS(" secs "));
++fieldsShown; ++fieldsShown;
} }
if (fieldsShown < 1) if (fieldsShown == 0)
{ {
n = abs ((int) inMilliseconds()) % 1000; n = std::abs ((int) inMilliseconds()) % 1000;
if (n > 0) if (n > 0)
{
result << n << TRANS(" ms"); result << n << TRANS(" ms");
++fieldsShown;
}
} }
} }
} }
@ -1626,33 +1582,6 @@ RelativeTime& RelativeTime::operator= (const RelativeTime& other) throw()
return *this; return *this;
} }
bool RelativeTime::operator== (const RelativeTime& other) const throw() { return seconds == other.seconds; }
bool RelativeTime::operator!= (const RelativeTime& other) const throw() { return seconds != other.seconds; }
bool RelativeTime::operator> (const RelativeTime& other) const throw() { return seconds > other.seconds; }
bool RelativeTime::operator< (const RelativeTime& other) const throw() { return seconds < other.seconds; }
bool RelativeTime::operator>= (const RelativeTime& other) const throw() { return seconds >= other.seconds; }
bool RelativeTime::operator<= (const RelativeTime& other) const throw() { return seconds <= other.seconds; }
const RelativeTime RelativeTime::operator+ (const RelativeTime& timeToAdd) const throw()
{
return RelativeTime (seconds + timeToAdd.seconds);
}
const RelativeTime RelativeTime::operator- (const RelativeTime& timeToSubtract) const throw()
{
return RelativeTime (seconds - timeToSubtract.seconds);
}
const RelativeTime RelativeTime::operator+ (const double secondsToAdd) const throw()
{
return RelativeTime (seconds + secondsToAdd);
}
const RelativeTime RelativeTime::operator- (const double secondsToSubtract) const throw()
{
return RelativeTime (seconds - secondsToSubtract);
}
const RelativeTime& RelativeTime::operator+= (const RelativeTime& timeToAdd) throw() const RelativeTime& RelativeTime::operator+= (const RelativeTime& timeToAdd) throw()
{ {
seconds += timeToAdd.seconds; seconds += timeToAdd.seconds;
@ -1677,6 +1606,16 @@ const RelativeTime& RelativeTime::operator-= (const double secondsToSubtract) th
return *this; return *this;
} }
bool operator== (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() == t2.inSeconds(); }
bool operator!= (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() != t2.inSeconds(); }
bool operator> (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() > t2.inSeconds(); }
bool operator< (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() < t2.inSeconds(); }
bool operator>= (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() >= t2.inSeconds(); }
bool operator<= (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() <= t2.inSeconds(); }
const RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) throw() { RelativeTime t (t1); return t += t2; }
const RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) throw() { RelativeTime t (t1); return t -= t2; }
END_JUCE_NAMESPACE END_JUCE_NAMESPACE
/*** End of inlined file: juce_RelativeTime.cpp ***/ /*** End of inlined file: juce_RelativeTime.cpp ***/
@ -2169,6 +2108,21 @@ const String Time::getWeekdayName (int day, const bool threeLetterVersion)
: longDayNames [day]); : longDayNames [day]);
} }
Time& Time::operator+= (const RelativeTime& delta) { millisSinceEpoch += delta.inMilliseconds(); return *this; }
Time& Time::operator-= (const RelativeTime& delta) { millisSinceEpoch -= delta.inMilliseconds(); return *this; }
const Time operator+ (const Time& time, const RelativeTime& delta) { Time t (time); return t += delta; }
const Time operator- (const Time& time, const RelativeTime& delta) { Time t (time); return t -= delta; }
const Time operator+ (const RelativeTime& delta, const Time& time) { Time t (time); return t += delta; }
const RelativeTime operator- (const Time& time1, const Time& time2) { return RelativeTime::milliseconds (time1.toMilliseconds() - time2.toMilliseconds()); }
bool operator== (const Time& time1, const Time& time2) { return time1.toMilliseconds() == time2.toMilliseconds(); }
bool operator!= (const Time& time1, const Time& time2) { return time1.toMilliseconds() != time2.toMilliseconds(); }
bool operator< (const Time& time1, const Time& time2) { return time1.toMilliseconds() < time2.toMilliseconds(); }
bool operator> (const Time& time1, const Time& time2) { return time1.toMilliseconds() > time2.toMilliseconds(); }
bool operator<= (const Time& time1, const Time& time2) { return time1.toMilliseconds() <= time2.toMilliseconds(); }
bool operator>= (const Time& time1, const Time& time2) { return time1.toMilliseconds() >= time2.toMilliseconds(); }
END_JUCE_NAMESPACE END_JUCE_NAMESPACE
/*** End of inlined file: juce_Time.cpp ***/ /*** End of inlined file: juce_Time.cpp ***/
@ -30537,12 +30491,12 @@ namespace
if (fileOrIdentifier.startsWithChar ('/') || fileOrIdentifier[1] == ':') if (fileOrIdentifier.startsWithChar ('/') || fileOrIdentifier[1] == ':')
return File (fileOrIdentifier).getLastModificationTime(); return File (fileOrIdentifier).getLastModificationTime();
return Time (0); return Time();
} }
bool timesAreDifferent (const Time& t1, const Time& t2) throw() bool timesAreDifferent (const Time& t1, const Time& t2) throw()
{ {
return t1 != t2 || t1 == Time (0); return t1 != t2 || t1 == Time();
} }
} }
@ -31548,7 +31502,7 @@ public:
desc.uid = ((int) componentDesc.componentType) desc.uid = ((int) componentDesc.componentType)
^ ((int) componentDesc.componentSubType) ^ ((int) componentDesc.componentSubType)
^ ((int) componentDesc.componentManufacturer); ^ ((int) componentDesc.componentManufacturer);
desc.lastFileModTime = 0; desc.lastFileModTime = Time();
desc.pluginFormatName = "AudioUnit"; desc.pluginFormatName = "AudioUnit";
desc.category = getCategory(); desc.category = getCategory();
desc.manufacturerName = manufacturer; desc.manufacturerName = manufacturer;
@ -39723,7 +39677,7 @@ private:
startThread (7); startThread (7);
} }
JUCE_DECLARE_NON_COPYABLE (InternalTimerThread); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InternalTimerThread);
}; };
InternalTimerThread* InternalTimerThread::instance = 0; InternalTimerThread* InternalTimerThread::instance = 0;
@ -41120,18 +41074,24 @@ Component* Component::removeChildComponent (const int index, bool sendParentEven
childComponentList_.remove (index); childComponentList_.remove (index);
child->parentComponent_ = 0; child->parentComponent_ = 0;
// (NB: there are obscure situations where a childShowing = false, but it still has the focus) // (NB: there are obscure situations where child->isShowing() = false, but it still has the focus)
if (currentlyFocusedComponent == child || child->isParentOf (currentlyFocusedComponent)) if (currentlyFocusedComponent == child || child->isParentOf (currentlyFocusedComponent))
{ {
const WeakReference<Component> thisPointer (this);
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
if (thisPointer == 0)
return child;
if (sendParentEvents) if (sendParentEvents)
{
const WeakReference<Component> thisPointer (this);
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
if (thisPointer == 0)
return child;
grabKeyboardFocus(); grabKeyboardFocus();
}
else
{
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
}
} }
if (sendChildEvents) if (sendChildEvents)
@ -71191,7 +71151,7 @@ public:
MouseInputSourceInternal (MouseInputSource& source_, const int index_, const bool isMouseDevice_) MouseInputSourceInternal (MouseInputSource& source_, const int index_, const bool isMouseDevice_)
: index (index_), isMouseDevice (isMouseDevice_), source (source_), lastPeer (0), : index (index_), isMouseDevice (isMouseDevice_), source (source_), lastPeer (0),
isUnboundedMouseModeOn (false), isCursorVisibleUntilOffscreen (false), currentCursorHandle (0), isUnboundedMouseModeOn (false), isCursorVisibleUntilOffscreen (false), currentCursorHandle (0),
mouseEventCounter (0), lastTime (0) mouseEventCounter (0)
{ {
} }
@ -71243,50 +71203,50 @@ public:
: lastScreenPos); : lastScreenPos);
} }
void sendMouseEnter (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseEnter (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseEnter (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseEnter (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseExit (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseExit (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseExit (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseExit (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseMove (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseMove (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseMove (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseMove (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseDown (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseDown (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDown (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseDown (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseDrag (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseDrag (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDrag (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseDrag (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseUp (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseUp (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseUp (source, comp->getLocalPoint (0, screenPos), time, getCurrentModifiers()); comp->internalMouseUp (source, comp->getLocalPoint (0, screenPos), time, getCurrentModifiers());
} }
void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const int64 time, float x, float y) void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const Time& time, float x, float y)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseWheel (source, comp->getLocalPoint (0, screenPos), time, x, y); comp->internalMouseWheel (source, comp->getLocalPoint (0, screenPos), time, x, y);
} }
// (returns true if the button change caused a modal event loop) // (returns true if the button change caused a modal event loop)
bool setButtons (const Point<int>& screenPos, const int64 time, const ModifierKeys& newButtonState) bool setButtons (const Point<int>& screenPos, const Time& time, const ModifierKeys& newButtonState)
{ {
if (buttonState == newButtonState) if (buttonState == newButtonState)
return false; return false;
@ -71330,7 +71290,7 @@ public:
return lastCounter != mouseEventCounter; return lastCounter != mouseEventCounter;
} }
void setComponentUnderMouse (Component* const newComponent, const Point<int>& screenPos, const int64 time) void setComponentUnderMouse (Component* const newComponent, const Point<int>& screenPos, const Time& time)
{ {
Component* current = getComponentUnderMouse(); Component* current = getComponentUnderMouse();
@ -71357,7 +71317,7 @@ public:
} }
} }
void setPeer (ComponentPeer* const newPeer, const Point<int>& screenPos, const int64 time) void setPeer (ComponentPeer* const newPeer, const Point<int>& screenPos, const Time& time)
{ {
ModifierKeys::updateCurrentModifiers(); ModifierKeys::updateCurrentModifiers();
@ -71369,7 +71329,7 @@ public:
} }
} }
void setScreenPos (const Point<int>& newScreenPos, const int64 time, const bool forceUpdate) void setScreenPos (const Point<int>& newScreenPos, const Time& time, const bool forceUpdate)
{ {
if (! isDragging()) if (! isDragging())
setComponentUnderMouse (findComponentAt (newScreenPos), newScreenPos, time); setComponentUnderMouse (findComponentAt (newScreenPos), newScreenPos, time);
@ -71401,7 +71361,7 @@ public:
} }
} }
void handleEvent (ComponentPeer* const newPeer, const Point<int>& positionWithinPeer, const int64 time, const ModifierKeys& newMods) void handleEvent (ComponentPeer* const newPeer, const Point<int>& positionWithinPeer, const Time& time, const ModifierKeys& newMods)
{ {
jassert (newPeer != 0); jassert (newPeer != 0);
lastTime = time; lastTime = time;
@ -71429,7 +71389,7 @@ public:
} }
} }
void handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, int64 time, float x, float y) void handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, const Time& time, float x, float y)
{ {
jassert (peer != 0); jassert (peer != 0);
lastTime = time; lastTime = time;
@ -71462,7 +71422,7 @@ public:
{ {
int numClicks = 0; int numClicks = 0;
if (mouseDowns[0].time != 0) if (mouseDowns[0].time != Time())
{ {
if (! mouseMovedSignificantlySincePressed) if (! mouseMovedSignificantlySincePressed)
++numClicks; ++numClicks;
@ -71482,7 +71442,7 @@ public:
bool hasMouseMovedSignificantlySincePressed() const throw() bool hasMouseMovedSignificantlySincePressed() const throw()
{ {
return mouseMovedSignificantlySincePressed return mouseMovedSignificantlySincePressed
|| lastTime > mouseDowns[0].time + 300; || lastTime > mouseDowns[0].time + RelativeTime::milliseconds (300);
} }
void triggerFakeMove() void triggerFakeMove()
@ -71492,7 +71452,7 @@ public:
void handleAsyncUpdate() void handleAsyncUpdate()
{ {
setScreenPos (lastScreenPos, jmax (lastTime, Time::currentTimeMillis()), true); setScreenPos (lastScreenPos, jmax (lastTime, Time::getCurrentTime()), true);
} }
void enableUnboundedMouseMovement (bool enable, bool keepCursorVisibleUntilOffscreen) void enableUnboundedMouseMovement (bool enable, bool keepCursorVisibleUntilOffscreen)
@ -71585,19 +71545,18 @@ private:
struct RecentMouseDown struct RecentMouseDown
{ {
RecentMouseDown() RecentMouseDown() : component (0)
: time (0), component (0)
{ {
} }
Point<int> position; Point<int> position;
int64 time; Time time;
Component* component; Component* component;
ModifierKeys buttons; ModifierKeys buttons;
bool canBePartOfMultipleClickWith (const RecentMouseDown& other, const int maxTimeBetween) const bool canBePartOfMultipleClickWith (const RecentMouseDown& other, const int maxTimeBetweenMs) const
{ {
return time - other.time < maxTimeBetween return time - other.time < RelativeTime::milliseconds (maxTimeBetweenMs)
&& abs (position.getX() - other.position.getX()) < 8 && abs (position.getX() - other.position.getX()) < 8
&& abs (position.getY() - other.position.getY()) < 8 && abs (position.getY() - other.position.getY()) < 8
&& buttons == other.buttons;; && buttons == other.buttons;;
@ -71606,9 +71565,9 @@ private:
RecentMouseDown mouseDowns[4]; RecentMouseDown mouseDowns[4];
bool mouseMovedSignificantlySincePressed; bool mouseMovedSignificantlySincePressed;
int64 lastTime; Time lastTime;
void registerMouseDown (const Point<int>& screenPos, const int64 time, void registerMouseDown (const Point<int>& screenPos, const Time& time,
Component* const component, const ModifierKeys& modifiers) throw() Component* const component, const ModifierKeys& modifiers) throw()
{ {
for (int i = numElementsInArray (mouseDowns); --i > 0;) for (int i = numElementsInArray (mouseDowns); --i > 0;)
@ -71663,12 +71622,12 @@ void MouseInputSource::forceMouseCursorUpdate() { pimpl->revealCursor (true);
void MouseInputSource::handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, const int64 time, const ModifierKeys& mods) void MouseInputSource::handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, const int64 time, const ModifierKeys& mods)
{ {
pimpl->handleEvent (peer, positionWithinPeer, time, mods.withOnlyMouseButtons()); pimpl->handleEvent (peer, positionWithinPeer, Time (time), mods.withOnlyMouseButtons());
} }
void MouseInputSource::handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, const int64 time, const float x, const float y) void MouseInputSource::handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, const int64 time, const float x, const float y)
{ {
pimpl->handleWheel (peer, positionWithinPeer, time, x, y); pimpl->handleWheel (peer, positionWithinPeer, Time (time), x, y);
} }
END_JUCE_NAMESPACE END_JUCE_NAMESPACE
@ -238880,8 +238839,8 @@ public:
if (isDir != 0) *isDir = ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); if (isDir != 0) *isDir = ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0);
if (isHidden != 0) *isHidden = ((findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0); if (isHidden != 0) *isHidden = ((findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0);
if (fileSize != 0) *fileSize = findData.nFileSizeLow + (((int64) findData.nFileSizeHigh) << 32); if (fileSize != 0) *fileSize = findData.nFileSizeLow + (((int64) findData.nFileSizeHigh) << 32);
if (modTime != 0) *modTime = fileTimeToTime (&findData.ftLastWriteTime); if (modTime != 0) *modTime = Time (fileTimeToTime (&findData.ftLastWriteTime));
if (creationTime != 0) *creationTime = fileTimeToTime (&findData.ftCreationTime); if (creationTime != 0) *creationTime = Time (fileTimeToTime (&findData.ftCreationTime));
if (isReadOnly != 0) *isReadOnly = ((findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) != 0); if (isReadOnly != 0) *isReadOnly = ((findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) != 0);
return true; return true;
@ -239173,11 +239132,6 @@ void NamedPipe::cancelPendingReads()
#define INTERNET_OPTION_DISABLE_AUTODIAL 70 #define INTERNET_OPTION_DISABLE_AUTODIAL 70
#endif #endif
struct ConnectionAndRequestStruct
{
HINTERNET connection, request;
};
static HINTERNET sessionHandle = 0; static HINTERNET sessionHandle = 0;
#ifndef WORKAROUND_TIMEOUT_BUG #ifndef WORKAROUND_TIMEOUT_BUG
@ -239437,7 +239391,6 @@ private:
buffers.lpcszHeader = static_cast <LPCTSTR> (headers); buffers.lpcszHeader = static_cast <LPCTSTR> (headers);
buffers.dwHeadersLength = headers.length(); buffers.dwHeadersLength = headers.length();
buffers.dwBufferTotal = (DWORD) postData.getSize(); buffers.dwBufferTotal = (DWORD) postData.getSize();
ConnectionAndRequestStruct* result = 0;
if (HttpSendRequestEx (request, &buffers, 0, HSR_INITIATE, 0)) if (HttpSendRequestEx (request, &buffers, 0, HSR_INITIATE, 0))
{ {
@ -242257,7 +242210,7 @@ public:
} }
} }
void handleTaskBarEvent (const LPARAM lParam, const WPARAM wParam) void handleTaskBarEvent (const LPARAM lParam)
{ {
if (component->isCurrentlyBlockedByAnotherModalComponent()) if (component->isCurrentlyBlockedByAnotherModalComponent())
{ {
@ -242282,8 +242235,8 @@ public:
eventMods = eventMods.withoutMouseButtons(); eventMods = eventMods.withoutMouseButtons();
const MouseEvent e (Desktop::getInstance().getMainMouseSource(), const MouseEvent e (Desktop::getInstance().getMainMouseSource(),
Point<int>(), eventMods, component, component, getMouseEventTime(), Point<int>(), eventMods, component, component, Time (getMouseEventTime()),
Point<int>(), getMouseEventTime(), 1, false); Point<int>(), Time (getMouseEventTime()), 1, false);
if (lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN) if (lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN)
{ {
@ -243495,7 +243448,7 @@ private:
return TRUE; return TRUE;
case WM_TRAYNOTIFY: case WM_TRAYNOTIFY:
handleTaskBarEvent (lParam, wParam); handleTaskBarEvent (lParam);
break; break;
case WM_SYNCPAINT: case WM_SYNCPAINT:
@ -253813,6 +253766,24 @@ namespace
return statfs (f.getFullPathName().toUTF8(), &result) == 0; return statfs (f.getFullPathName().toUTF8(), &result) == 0;
} }
void updateStatInfoForFile (const String& path, bool* const isDir, int64* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly)
{
if (isDir != 0 || fileSize != 0 || modTime != 0 || creationTime != 0)
{
juce_statStruct info;
const bool statOk = juce_stat (path, info);
if (isDir != 0) *isDir = statOk && ((info.st_mode & S_IFDIR) != 0);
if (fileSize != 0) *fileSize = statOk ? info.st_size : 0;
if (modTime != 0) *modTime = Time (statOk ? (int64) info.st_mtime * 1000 : 0);
if (creationTime != 0) *creationTime = Time (statOk ? (int64) info.st_ctime * 1000 : 0);
}
if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;
}
} }
bool File::isDirectory() const bool File::isDirectory() const
@ -254519,9 +254490,6 @@ public:
wildCard (wildCard_), wildCard (wildCard_),
dir (opendir (directory.getFullPathName().toUTF8())) dir (opendir (directory.getFullPathName().toUTF8()))
{ {
if (wildCard == "*.*")
wildCard = "*";
wildcardUTF8 = wildCard.toUTF8(); wildcardUTF8 = wildCard.toUTF8();
} }
@ -254535,41 +254503,30 @@ public:
bool* const isDir, bool* const isHidden, int64* const fileSize, bool* const isDir, bool* const isHidden, int64* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly) Time* const modTime, Time* const creationTime, bool* const isReadOnly)
{ {
if (dir == 0) if (dir != 0)
return false;
for (;;)
{ {
struct dirent* const de = readdir (dir); for (;;)
if (de == 0)
return false;
if (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0)
{ {
filenameFound = String::fromUTF8 (de->d_name); struct dirent* const de = readdir (dir);
const String path (parentDir + filenameFound);
if (isDir != 0 || fileSize != 0 || modTime != 0 || creationTime != 0) if (de == 0)
break;
if (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0)
{ {
struct stat info; filenameFound = String::fromUTF8 (de->d_name);
const bool statOk = juce_stat (path, info);
if (isDir != 0) *isDir = statOk && ((info.st_mode & S_IFDIR) != 0); updateStatInfoForFile (parentDir + filenameFound, isDir, fileSize, modTime, creationTime, isReadOnly);
if (fileSize != 0) *fileSize = statOk ? info.st_size : 0;
if (modTime != 0) *modTime = statOk ? (int64) info.st_mtime * 1000 : 0; if (isHidden != 0)
if (creationTime != 0) *creationTime = statOk ? (int64) info.st_ctime * 1000 : 0; *isHidden = filenameFound.startsWithChar ('.');
return true;
} }
if (isHidden != 0)
*isHidden = filenameFound.startsWithChar ('.');
if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;
return true;
} }
} }
return false;
} }
private: private:
@ -263681,6 +263638,24 @@ namespace
return statfs (f.getFullPathName().toUTF8(), &result) == 0; return statfs (f.getFullPathName().toUTF8(), &result) == 0;
} }
void updateStatInfoForFile (const String& path, bool* const isDir, int64* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly)
{
if (isDir != 0 || fileSize != 0 || modTime != 0 || creationTime != 0)
{
juce_statStruct info;
const bool statOk = juce_stat (path, info);
if (isDir != 0) *isDir = statOk && ((info.st_mode & S_IFDIR) != 0);
if (fileSize != 0) *fileSize = statOk ? info.st_size : 0;
if (modTime != 0) *modTime = Time (statOk ? (int64) info.st_mtime * 1000 : 0);
if (creationTime != 0) *creationTime = Time (statOk ? (int64) info.st_ctime * 1000 : 0);
}
if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;
}
} }
bool File::isDirectory() const bool File::isDirectory() const
@ -264506,24 +264481,11 @@ public:
continue; continue;
const String path (parentDir + filenameFound); const String path (parentDir + filenameFound);
updateStatInfoForFile (path, isDir, fileSize, modTime, creationTime, isReadOnly);
if (isDir != 0 || fileSize != 0 || modTime != 0 || creationTime != 0)
{
juce_statStruct info;
const bool statOk = juce_stat (path, info);
if (isDir != 0) *isDir = statOk && ((info.st_mode & S_IFDIR) != 0);
if (fileSize != 0) *fileSize = statOk ? info.st_size : 0;
if (modTime != 0) *modTime = statOk ? (int64) info.st_mtime * 1000 : 0;
if (creationTime != 0) *creationTime = statOk ? (int64) info.st_ctime * 1000 : 0;
}
if (isHidden != 0) if (isHidden != 0)
*isHidden = FileHelpers::isHiddenFile (path); *isHidden = FileHelpers::isHiddenFile (path);
if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;
return true; return true;
} }
} }

View file

@ -64,7 +64,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 109 #define JUCE_BUILDNUMBER 110
/** Current Juce version number. /** Current Juce version number.
@ -3296,7 +3296,8 @@ private:
} }
}; };
#if DOXYGEN || (JUCE_CHECK_MEMORY_LEAKS && ! defined (JUCE_LEAK_DETECTOR)) #if DOXYGEN || ! defined (JUCE_LEAK_DETECTOR)
#if (DOXYGEN || JUCE_CHECK_MEMORY_LEAKS)
/** This macro lets you embed a leak-detecting object inside a class. /** This macro lets you embed a leak-detecting object inside a class.
To use it, simply declare a JUCE_LEAK_DETECTOR(YourClassName) inside a private section To use it, simply declare a JUCE_LEAK_DETECTOR(YourClassName) inside a private section
@ -3316,8 +3317,9 @@ private:
@see JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, LeakedObjectDetector @see JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, LeakedObjectDetector
*/ */
#define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__); #define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__);
#else #else
#define JUCE_LEAK_DETECTOR(OwnerClass) #define JUCE_LEAK_DETECTOR(OwnerClass)
#endif
#endif #endif
#endif // __JUCE_LEAKEDOBJECTDETECTOR_JUCEHEADER__ #endif // __JUCE_LEAKEDOBJECTDETECTOR_JUCEHEADER__
@ -7885,73 +7887,61 @@ public:
~RelativeTime() throw(); ~RelativeTime() throw();
/** Creates a new RelativeTime object representing a number of milliseconds. /** Creates a new RelativeTime object representing a number of milliseconds.
@see minutes, hours, days, weeks @see minutes, hours, days, weeks
*/ */
static const RelativeTime milliseconds (int milliseconds) throw(); static const RelativeTime milliseconds (int milliseconds) throw();
/** Creates a new RelativeTime object representing a number of milliseconds. /** Creates a new RelativeTime object representing a number of milliseconds.
@see minutes, hours, days, weeks @see minutes, hours, days, weeks
*/ */
static const RelativeTime milliseconds (int64 milliseconds) throw(); static const RelativeTime milliseconds (int64 milliseconds) throw();
/** Creates a new RelativeTime object representing a number of minutes. /** Creates a new RelativeTime object representing a number of minutes.
@see milliseconds, hours, days, weeks @see milliseconds, hours, days, weeks
*/ */
static const RelativeTime minutes (double numberOfMinutes) throw(); static const RelativeTime minutes (double numberOfMinutes) throw();
/** Creates a new RelativeTime object representing a number of hours. /** Creates a new RelativeTime object representing a number of hours.
@see milliseconds, minutes, days, weeks @see milliseconds, minutes, days, weeks
*/ */
static const RelativeTime hours (double numberOfHours) throw(); static const RelativeTime hours (double numberOfHours) throw();
/** Creates a new RelativeTime object representing a number of days. /** Creates a new RelativeTime object representing a number of days.
@see milliseconds, minutes, hours, weeks @see milliseconds, minutes, hours, weeks
*/ */
static const RelativeTime days (double numberOfDays) throw(); static const RelativeTime days (double numberOfDays) throw();
/** Creates a new RelativeTime object representing a number of weeks. /** Creates a new RelativeTime object representing a number of weeks.
@see milliseconds, minutes, hours, days @see milliseconds, minutes, hours, days
*/ */
static const RelativeTime weeks (double numberOfWeeks) throw(); static const RelativeTime weeks (double numberOfWeeks) throw();
/** Returns the number of milliseconds this time represents. /** Returns the number of milliseconds this time represents.
@see milliseconds, inSeconds, inMinutes, inHours, inDays, inWeeks @see milliseconds, inSeconds, inMinutes, inHours, inDays, inWeeks
*/ */
int64 inMilliseconds() const throw(); int64 inMilliseconds() const throw();
/** Returns the number of seconds this time represents. /** Returns the number of seconds this time represents.
@see inMilliseconds, inMinutes, inHours, inDays, inWeeks @see inMilliseconds, inMinutes, inHours, inDays, inWeeks
*/ */
double inSeconds() const throw() { return seconds; } double inSeconds() const throw() { return seconds; }
/** Returns the number of minutes this time represents. /** Returns the number of minutes this time represents.
@see inMilliseconds, inSeconds, inHours, inDays, inWeeks @see inMilliseconds, inSeconds, inHours, inDays, inWeeks
*/ */
double inMinutes() const throw(); double inMinutes() const throw();
/** Returns the number of hours this time represents. /** Returns the number of hours this time represents.
@see inMilliseconds, inSeconds, inMinutes, inDays, inWeeks @see inMilliseconds, inSeconds, inMinutes, inDays, inWeeks
*/ */
double inHours() const throw(); double inHours() const throw();
/** Returns the number of days this time represents. /** Returns the number of days this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inWeeks @see inMilliseconds, inSeconds, inMinutes, inHours, inWeeks
*/ */
double inDays() const throw(); double inDays() const throw();
/** Returns the number of weeks this time represents. /** Returns the number of weeks this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inDays @see inMilliseconds, inSeconds, inMinutes, inHours, inDays
*/ */
double inWeeks() const throw(); double inWeeks() const throw();
@ -7973,30 +7963,6 @@ public:
*/ */
const String getDescription (const String& returnValueForZeroTime = "0") const; const String getDescription (const String& returnValueForZeroTime = "0") const;
/** Compares two RelativeTimes. */
bool operator== (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator!= (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator> (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator< (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator>= (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator<= (const RelativeTime& other) const throw();
/** Adds another RelativeTime to this one and returns the result. */
const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
/** Subtracts another RelativeTime from this one and returns the result. */
const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
/** Adds a number of seconds to this RelativeTime and returns the result. */
const RelativeTime operator+ (double secondsToAdd) const throw();
/** Subtracts a number of seconds from this RelativeTime and returns the result. */
const RelativeTime operator- (double secondsToSubtract) const throw();
/** Adds another RelativeTime to this one. */ /** Adds another RelativeTime to this one. */
const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw(); const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
/** Subtracts another RelativeTime from this one. */ /** Subtracts another RelativeTime from this one. */
@ -8004,7 +7970,6 @@ public:
/** Adds a number of seconds to this time. */ /** Adds a number of seconds to this time. */
const RelativeTime& operator+= (double secondsToAdd) throw(); const RelativeTime& operator+= (double secondsToAdd) throw();
/** Subtracts a number of seconds from this time. */ /** Subtracts a number of seconds from this time. */
const RelativeTime& operator-= (double secondsToSubtract) throw(); const RelativeTime& operator-= (double secondsToSubtract) throw();
@ -8013,6 +7978,24 @@ private:
double seconds; double seconds;
}; };
/** Compares two RelativeTimes. */
bool operator== (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator!= (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator> (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator< (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator>= (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator<= (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Adds two RelativeTimes together. */
const RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Subtracts two RelativeTimes. */
const RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) throw();
#endif // __JUCE_RELATIVETIME_JUCEHEADER__ #endif // __JUCE_RELATIVETIME_JUCEHEADER__
/*** End of inlined file: juce_RelativeTime.h ***/ /*** End of inlined file: juce_RelativeTime.h ***/
@ -8038,9 +8021,6 @@ public:
*/ */
Time() throw(); Time() throw();
/** Creates a copy of another Time object. */
Time (const Time& other) throw();
/** Creates a time based on a number of milliseconds. /** Creates a time based on a number of milliseconds.
The internal millisecond count is set to 0 (1st January 1970). To create a The internal millisecond count is set to 0 (1st January 1970). To create a
@ -8050,7 +8030,7 @@ public:
'epoch' (midnight Jan 1st 1970). 'epoch' (midnight Jan 1st 1970).
@see getCurrentTime, currentTimeMillis @see getCurrentTime, currentTimeMillis
*/ */
Time (int64 millisecondsSinceEpoch) throw(); explicit Time (int64 millisecondsSinceEpoch) throw();
/** Creates a time from a set of date components. /** Creates a time from a set of date components.
@ -8075,6 +8055,9 @@ public:
int milliseconds = 0, int milliseconds = 0,
bool useLocalTime = true) throw(); bool useLocalTime = true) throw();
/** Creates a copy of another Time object. */
Time (const Time& other) throw();
/** Destructor. */ /** Destructor. */
~Time() throw(); ~Time() throw();
@ -8231,32 +8214,10 @@ public:
*/ */
const String formatted (const String& format) const; const String formatted (const String& format) const;
/** Adds a RelativeTime to this time and returns the result. */ /** Adds a RelativeTime to this time. */
const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); } Time& operator+= (const RelativeTime& delta);
/** Subtracts a RelativeTime from this time. */
/** Subtracts a RelativeTime from this time and returns the result. */ Time& operator-= (const RelativeTime& delta);
const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
/** Returns the relative time difference between this time and another one. */
const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
/** Compares two Time objects. */
bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
/** Tries to set the computer's clock. /** Tries to set the computer's clock.
@ -8368,6 +8329,29 @@ private:
int64 millisSinceEpoch; int64 millisSinceEpoch;
}; };
/** Adds a RelativeTime to a Time. */
const Time operator+ (const Time& time, const RelativeTime& delta);
/** Adds a RelativeTime to a Time. */
const Time operator+ (const RelativeTime& delta, const Time& time);
/** Subtracts a RelativeTime from a Time. */
const Time operator- (const Time& time, const RelativeTime& delta);
/** Returns the relative time difference between two times. */
const RelativeTime operator- (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator== (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator!= (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator< (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator<= (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator> (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator>= (const Time& time1, const Time& time2);
#endif // __JUCE_TIME_JUCEHEADER__ #endif // __JUCE_TIME_JUCEHEADER__
/*** End of inlined file: juce_Time.h ***/ /*** End of inlined file: juce_Time.h ***/
@ -17469,7 +17453,7 @@ public:
/** When evaluating an Expression object, this class is used to resolve symbols and /** When evaluating an Expression object, this class is used to resolve symbols and
perform functions that the expression uses. perform functions that the expression uses.
*/ */
class EvaluationContext class JUCE_API EvaluationContext
{ {
public: public:
EvaluationContext(); EvaluationContext();
@ -19386,6 +19370,7 @@ private:
const int threadStopTimeout; const int threadStopTimeout;
int priority; int priority;
class ThreadPoolThread; class ThreadPoolThread;
friend class OwnedArray <ThreadPoolThread>;
OwnedArray <ThreadPoolThread> threads; OwnedArray <ThreadPoolThread> threads;
Array <ThreadPoolJob*> jobs; Array <ThreadPoolJob*> jobs;
@ -36591,7 +36576,7 @@ public:
@see Button::addListener, Button::removeListener @see Button::addListener, Button::removeListener
*/ */
class Listener class JUCE_API Listener
{ {
public: public:
/** Destructor. */ /** Destructor. */

View file

@ -212,7 +212,7 @@ public:
desc.uid = ((int) componentDesc.componentType) desc.uid = ((int) componentDesc.componentType)
^ ((int) componentDesc.componentSubType) ^ ((int) componentDesc.componentSubType)
^ ((int) componentDesc.componentManufacturer); ^ ((int) componentDesc.componentManufacturer);
desc.lastFileModTime = 0; desc.lastFileModTime = Time();
desc.pluginFormatName = "AudioUnit"; desc.pluginFormatName = "AudioUnit";
desc.category = getCategory(); desc.category = getCategory();
desc.manufacturerName = manufacturer; desc.manufacturerName = manufacturer;

View file

@ -100,12 +100,12 @@ namespace
if (fileOrIdentifier.startsWithChar ('/') || fileOrIdentifier[1] == ':') if (fileOrIdentifier.startsWithChar ('/') || fileOrIdentifier[1] == ':')
return File (fileOrIdentifier).getLastModificationTime(); return File (fileOrIdentifier).getLastModificationTime();
return Time (0); return Time();
} }
bool timesAreDifferent (const Time& t1, const Time& t2) throw() bool timesAreDifferent (const Time& t1, const Time& t2) throw()
{ {
return t1 != t2 || t1 == Time (0); return t1 != t2 || t1 == Time();
} }
} }

View file

@ -47,127 +47,84 @@ RelativeTime::~RelativeTime() throw()
} }
//============================================================================== //==============================================================================
const RelativeTime RelativeTime::milliseconds (const int milliseconds) throw() const RelativeTime RelativeTime::milliseconds (const int milliseconds) throw() { return RelativeTime (milliseconds * 0.001); }
{ const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) throw() { return RelativeTime (milliseconds * 0.001); }
return RelativeTime (milliseconds * 0.001); const RelativeTime RelativeTime::minutes (const double numberOfMinutes) throw() { return RelativeTime (numberOfMinutes * 60.0); }
} const RelativeTime RelativeTime::hours (const double numberOfHours) throw() { return RelativeTime (numberOfHours * (60.0 * 60.0)); }
const RelativeTime RelativeTime::days (const double numberOfDays) throw() { return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0)); }
const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) throw() const RelativeTime RelativeTime::weeks (const double numberOfWeeks) throw() { return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0)); }
{
return RelativeTime (milliseconds * 0.001);
}
const RelativeTime RelativeTime::minutes (const double numberOfMinutes) throw()
{
return RelativeTime (numberOfMinutes * 60.0);
}
const RelativeTime RelativeTime::hours (const double numberOfHours) throw()
{
return RelativeTime (numberOfHours * (60.0 * 60.0));
}
const RelativeTime RelativeTime::days (const double numberOfDays) throw()
{
return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0));
}
const RelativeTime RelativeTime::weeks (const double numberOfWeeks) throw()
{
return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0));
}
//============================================================================== //==============================================================================
int64 RelativeTime::inMilliseconds() const throw() int64 RelativeTime::inMilliseconds() const throw() { return (int64) (seconds * 1000.0); }
{ double RelativeTime::inMinutes() const throw() { return seconds / 60.0; }
return (int64) (seconds * 1000.0); double RelativeTime::inHours() const throw() { return seconds / (60.0 * 60.0); }
} double RelativeTime::inDays() const throw() { return seconds / (60.0 * 60.0 * 24.0); }
double RelativeTime::inWeeks() const throw() { return seconds / (60.0 * 60.0 * 24.0 * 7.0); }
double RelativeTime::inMinutes() const throw()
{
return seconds / 60.0;
}
double RelativeTime::inHours() const throw()
{
return seconds / (60.0 * 60.0);
}
double RelativeTime::inDays() const throw()
{
return seconds / (60.0 * 60.0 * 24.0);
}
double RelativeTime::inWeeks() const throw()
{
return seconds / (60.0 * 60.0 * 24.0 * 7.0);
}
//==============================================================================
const String RelativeTime::getDescription (const String& returnValueForZeroTime) const const String RelativeTime::getDescription (const String& returnValueForZeroTime) const
{ {
if (seconds < 0.001 && seconds > -0.001) if (seconds < 0.001 && seconds > -0.001)
return returnValueForZeroTime; return returnValueForZeroTime;
String result; String result;
result.preallocateStorage (16);
if (seconds < 0) if (seconds < 0)
result = "-"; result << '-';
int fieldsShown = 0; int fieldsShown = 0;
int n = abs ((int) inWeeks()); int n = std::abs ((int) inWeeks());
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" week ") result << n << (n == 1 ? TRANS(" week ")
: TRANS(" weeks ")); : TRANS(" weeks "));
++fieldsShown; ++fieldsShown;
} }
n = abs ((int) inDays()) % 7; n = std::abs ((int) inDays()) % 7;
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" day ") result << n << (n == 1 ? TRANS(" day ")
: TRANS(" days ")); : TRANS(" days "));
++fieldsShown; ++fieldsShown;
} }
if (fieldsShown < 2) if (fieldsShown < 2)
{ {
n = abs ((int) inHours()) % 24; n = std::abs ((int) inHours()) % 24;
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" hr ") result << n << (n == 1 ? TRANS(" hr ")
: TRANS(" hrs ")); : TRANS(" hrs "));
++fieldsShown; ++fieldsShown;
} }
if (fieldsShown < 2) if (fieldsShown < 2)
{ {
n = abs ((int) inMinutes()) % 60; n = std::abs ((int) inMinutes()) % 60;
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" min ") result << n << (n == 1 ? TRANS(" min ")
: TRANS(" mins ")); : TRANS(" mins "));
++fieldsShown; ++fieldsShown;
} }
if (fieldsShown < 2) if (fieldsShown < 2)
{ {
n = abs ((int) inSeconds()) % 60; n = std::abs ((int) inSeconds()) % 60;
if (n > 0) if (n > 0)
{ {
result << n << ((n == 1) ? TRANS(" sec ") result << n << (n == 1 ? TRANS(" sec ")
: TRANS(" secs ")); : TRANS(" secs "));
++fieldsShown; ++fieldsShown;
} }
if (fieldsShown < 1) if (fieldsShown == 0)
{ {
n = abs ((int) inMilliseconds()) % 1000; n = std::abs ((int) inMilliseconds()) % 1000;
if (n > 0) if (n > 0)
{
result << n << TRANS(" ms"); result << n << TRANS(" ms");
++fieldsShown;
}
} }
} }
} }
@ -183,34 +140,6 @@ RelativeTime& RelativeTime::operator= (const RelativeTime& other) throw()
return *this; return *this;
} }
bool RelativeTime::operator== (const RelativeTime& other) const throw() { return seconds == other.seconds; }
bool RelativeTime::operator!= (const RelativeTime& other) const throw() { return seconds != other.seconds; }
bool RelativeTime::operator> (const RelativeTime& other) const throw() { return seconds > other.seconds; }
bool RelativeTime::operator< (const RelativeTime& other) const throw() { return seconds < other.seconds; }
bool RelativeTime::operator>= (const RelativeTime& other) const throw() { return seconds >= other.seconds; }
bool RelativeTime::operator<= (const RelativeTime& other) const throw() { return seconds <= other.seconds; }
//==============================================================================
const RelativeTime RelativeTime::operator+ (const RelativeTime& timeToAdd) const throw()
{
return RelativeTime (seconds + timeToAdd.seconds);
}
const RelativeTime RelativeTime::operator- (const RelativeTime& timeToSubtract) const throw()
{
return RelativeTime (seconds - timeToSubtract.seconds);
}
const RelativeTime RelativeTime::operator+ (const double secondsToAdd) const throw()
{
return RelativeTime (seconds + secondsToAdd);
}
const RelativeTime RelativeTime::operator- (const double secondsToSubtract) const throw()
{
return RelativeTime (seconds - secondsToSubtract);
}
//============================================================================== //==============================================================================
const RelativeTime& RelativeTime::operator+= (const RelativeTime& timeToAdd) throw() const RelativeTime& RelativeTime::operator+= (const RelativeTime& timeToAdd) throw()
{ {
@ -236,4 +165,15 @@ const RelativeTime& RelativeTime::operator-= (const double secondsToSubtract) th
return *this; return *this;
} }
bool operator== (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() == t2.inSeconds(); }
bool operator!= (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() != t2.inSeconds(); }
bool operator> (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() > t2.inSeconds(); }
bool operator< (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() < t2.inSeconds(); }
bool operator>= (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() >= t2.inSeconds(); }
bool operator<= (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() <= t2.inSeconds(); }
const RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) throw() { RelativeTime t (t1); return t += t2; }
const RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) throw() { RelativeTime t (t1); return t -= t2; }
END_JUCE_NAMESPACE END_JUCE_NAMESPACE

View file

@ -59,74 +59,62 @@ public:
//============================================================================== //==============================================================================
/** Creates a new RelativeTime object representing a number of milliseconds. /** Creates a new RelativeTime object representing a number of milliseconds.
@see minutes, hours, days, weeks @see minutes, hours, days, weeks
*/ */
static const RelativeTime milliseconds (int milliseconds) throw(); static const RelativeTime milliseconds (int milliseconds) throw();
/** Creates a new RelativeTime object representing a number of milliseconds. /** Creates a new RelativeTime object representing a number of milliseconds.
@see minutes, hours, days, weeks @see minutes, hours, days, weeks
*/ */
static const RelativeTime milliseconds (int64 milliseconds) throw(); static const RelativeTime milliseconds (int64 milliseconds) throw();
/** Creates a new RelativeTime object representing a number of minutes. /** Creates a new RelativeTime object representing a number of minutes.
@see milliseconds, hours, days, weeks @see milliseconds, hours, days, weeks
*/ */
static const RelativeTime minutes (double numberOfMinutes) throw(); static const RelativeTime minutes (double numberOfMinutes) throw();
/** Creates a new RelativeTime object representing a number of hours. /** Creates a new RelativeTime object representing a number of hours.
@see milliseconds, minutes, days, weeks @see milliseconds, minutes, days, weeks
*/ */
static const RelativeTime hours (double numberOfHours) throw(); static const RelativeTime hours (double numberOfHours) throw();
/** Creates a new RelativeTime object representing a number of days. /** Creates a new RelativeTime object representing a number of days.
@see milliseconds, minutes, hours, weeks @see milliseconds, minutes, hours, weeks
*/ */
static const RelativeTime days (double numberOfDays) throw(); static const RelativeTime days (double numberOfDays) throw();
/** Creates a new RelativeTime object representing a number of weeks. /** Creates a new RelativeTime object representing a number of weeks.
@see milliseconds, minutes, hours, days @see milliseconds, minutes, hours, days
*/ */
static const RelativeTime weeks (double numberOfWeeks) throw(); static const RelativeTime weeks (double numberOfWeeks) throw();
//============================================================================== //==============================================================================
/** Returns the number of milliseconds this time represents. /** Returns the number of milliseconds this time represents.
@see milliseconds, inSeconds, inMinutes, inHours, inDays, inWeeks @see milliseconds, inSeconds, inMinutes, inHours, inDays, inWeeks
*/ */
int64 inMilliseconds() const throw(); int64 inMilliseconds() const throw();
/** Returns the number of seconds this time represents. /** Returns the number of seconds this time represents.
@see inMilliseconds, inMinutes, inHours, inDays, inWeeks @see inMilliseconds, inMinutes, inHours, inDays, inWeeks
*/ */
double inSeconds() const throw() { return seconds; } double inSeconds() const throw() { return seconds; }
/** Returns the number of minutes this time represents. /** Returns the number of minutes this time represents.
@see inMilliseconds, inSeconds, inHours, inDays, inWeeks @see inMilliseconds, inSeconds, inHours, inDays, inWeeks
*/ */
double inMinutes() const throw(); double inMinutes() const throw();
/** Returns the number of hours this time represents. /** Returns the number of hours this time represents.
@see inMilliseconds, inSeconds, inMinutes, inDays, inWeeks @see inMilliseconds, inSeconds, inMinutes, inDays, inWeeks
*/ */
double inHours() const throw(); double inHours() const throw();
/** Returns the number of days this time represents. /** Returns the number of days this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inWeeks @see inMilliseconds, inSeconds, inMinutes, inHours, inWeeks
*/ */
double inDays() const throw(); double inDays() const throw();
/** Returns the number of weeks this time represents. /** Returns the number of weeks this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inDays @see inMilliseconds, inSeconds, inMinutes, inHours, inDays
*/ */
double inWeeks() const throw(); double inWeeks() const throw();
@ -148,33 +136,8 @@ public:
*/ */
const String getDescription (const String& returnValueForZeroTime = "0") const; const String getDescription (const String& returnValueForZeroTime = "0") const;
//==============================================================================
/** Compares two RelativeTimes. */
bool operator== (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator!= (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator> (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator< (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator>= (const RelativeTime& other) const throw();
/** Compares two RelativeTimes. */
bool operator<= (const RelativeTime& other) const throw();
//============================================================================== //==============================================================================
/** Adds another RelativeTime to this one and returns the result. */
const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
/** Subtracts another RelativeTime from this one and returns the result. */
const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
/** Adds a number of seconds to this RelativeTime and returns the result. */
const RelativeTime operator+ (double secondsToAdd) const throw();
/** Subtracts a number of seconds from this RelativeTime and returns the result. */
const RelativeTime operator- (double secondsToSubtract) const throw();
/** Adds another RelativeTime to this one. */ /** Adds another RelativeTime to this one. */
const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw(); const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
/** Subtracts another RelativeTime from this one. */ /** Subtracts another RelativeTime from this one. */
@ -182,15 +145,34 @@ public:
/** Adds a number of seconds to this time. */ /** Adds a number of seconds to this time. */
const RelativeTime& operator+= (double secondsToAdd) throw(); const RelativeTime& operator+= (double secondsToAdd) throw();
/** Subtracts a number of seconds from this time. */ /** Subtracts a number of seconds from this time. */
const RelativeTime& operator-= (double secondsToSubtract) throw(); const RelativeTime& operator-= (double secondsToSubtract) throw();
private: private:
//============================================================================== //==============================================================================
double seconds; double seconds;
}; };
//==============================================================================
/** Compares two RelativeTimes. */
bool operator== (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator!= (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator> (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator< (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator>= (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Compares two RelativeTimes. */
bool operator<= (const RelativeTime& t1, const RelativeTime& t2) throw();
//==============================================================================
/** Adds two RelativeTimes together. */
const RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) throw();
/** Subtracts two RelativeTimes. */
const RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) throw();
#endif // __JUCE_RELATIVETIME_JUCEHEADER__ #endif // __JUCE_RELATIVETIME_JUCEHEADER__

View file

@ -33,7 +33,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 109 #define JUCE_BUILDNUMBER 110
/** Current Juce version number. /** Current Juce version number.

View file

@ -496,4 +496,21 @@ const String Time::getWeekdayName (int day, const bool threeLetterVersion)
: longDayNames [day]); : longDayNames [day]);
} }
//==============================================================================
Time& Time::operator+= (const RelativeTime& delta) { millisSinceEpoch += delta.inMilliseconds(); return *this; }
Time& Time::operator-= (const RelativeTime& delta) { millisSinceEpoch -= delta.inMilliseconds(); return *this; }
const Time operator+ (const Time& time, const RelativeTime& delta) { Time t (time); return t += delta; }
const Time operator- (const Time& time, const RelativeTime& delta) { Time t (time); return t -= delta; }
const Time operator+ (const RelativeTime& delta, const Time& time) { Time t (time); return t += delta; }
const RelativeTime operator- (const Time& time1, const Time& time2) { return RelativeTime::milliseconds (time1.toMilliseconds() - time2.toMilliseconds()); }
bool operator== (const Time& time1, const Time& time2) { return time1.toMilliseconds() == time2.toMilliseconds(); }
bool operator!= (const Time& time1, const Time& time2) { return time1.toMilliseconds() != time2.toMilliseconds(); }
bool operator< (const Time& time1, const Time& time2) { return time1.toMilliseconds() < time2.toMilliseconds(); }
bool operator> (const Time& time1, const Time& time2) { return time1.toMilliseconds() > time2.toMilliseconds(); }
bool operator<= (const Time& time1, const Time& time2) { return time1.toMilliseconds() <= time2.toMilliseconds(); }
bool operator>= (const Time& time1, const Time& time2) { return time1.toMilliseconds() >= time2.toMilliseconds(); }
END_JUCE_NAMESPACE END_JUCE_NAMESPACE

View file

@ -52,9 +52,6 @@ public:
*/ */
Time() throw(); Time() throw();
/** Creates a copy of another Time object. */
Time (const Time& other) throw();
/** Creates a time based on a number of milliseconds. /** Creates a time based on a number of milliseconds.
The internal millisecond count is set to 0 (1st January 1970). To create a The internal millisecond count is set to 0 (1st January 1970). To create a
@ -64,7 +61,7 @@ public:
'epoch' (midnight Jan 1st 1970). 'epoch' (midnight Jan 1st 1970).
@see getCurrentTime, currentTimeMillis @see getCurrentTime, currentTimeMillis
*/ */
Time (int64 millisecondsSinceEpoch) throw(); explicit Time (int64 millisecondsSinceEpoch) throw();
/** Creates a time from a set of date components. /** Creates a time from a set of date components.
@ -89,6 +86,9 @@ public:
int milliseconds = 0, int milliseconds = 0,
bool useLocalTime = true) throw(); bool useLocalTime = true) throw();
/** Creates a copy of another Time object. */
Time (const Time& other) throw();
/** Destructor. */ /** Destructor. */
~Time() throw(); ~Time() throw();
@ -248,32 +248,10 @@ public:
const String formatted (const String& format) const; const String formatted (const String& format) const;
//============================================================================== //==============================================================================
/** Adds a RelativeTime to this time and returns the result. */ /** Adds a RelativeTime to this time. */
const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); } Time& operator+= (const RelativeTime& delta);
/** Subtracts a RelativeTime from this time. */
/** Subtracts a RelativeTime from this time and returns the result. */ Time& operator-= (const RelativeTime& delta);
const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
/** Returns the relative time difference between this time and another one. */
const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
/** Compares two Time objects. */
bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
/** Compares two Time objects. */
bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
//============================================================================== //==============================================================================
/** Tries to set the computer's clock. /** Tries to set the computer's clock.
@ -390,5 +368,29 @@ private:
int64 millisSinceEpoch; int64 millisSinceEpoch;
}; };
//==============================================================================
/** Adds a RelativeTime to a Time. */
const Time operator+ (const Time& time, const RelativeTime& delta);
/** Adds a RelativeTime to a Time. */
const Time operator+ (const RelativeTime& delta, const Time& time);
/** Subtracts a RelativeTime from a Time. */
const Time operator- (const Time& time, const RelativeTime& delta);
/** Returns the relative time difference between two times. */
const RelativeTime operator- (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator== (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator!= (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator< (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator<= (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator> (const Time& time1, const Time& time2);
/** Compares two Time objects. */
bool operator>= (const Time& time1, const Time& time2);
#endif // __JUCE_TIME_JUCEHEADER__ #endif // __JUCE_TIME_JUCEHEADER__

View file

@ -317,7 +317,7 @@ private:
startThread (7); startThread (7);
} }
JUCE_DECLARE_NON_COPYABLE (InternalTimerThread); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InternalTimerThread);
}; };
InternalTimerThread* InternalTimerThread::instance = 0; InternalTimerThread* InternalTimerThread::instance = 0;

View file

@ -178,7 +178,7 @@ public:
@see Button::addListener, Button::removeListener @see Button::addListener, Button::removeListener
*/ */
class Listener class JUCE_API Listener
{ {
public: public:
/** Destructor. */ /** Destructor. */

View file

@ -1368,18 +1368,24 @@ Component* Component::removeChildComponent (const int index, bool sendParentEven
childComponentList_.remove (index); childComponentList_.remove (index);
child->parentComponent_ = 0; child->parentComponent_ = 0;
// (NB: there are obscure situations where a childShowing = false, but it still has the focus) // (NB: there are obscure situations where child->isShowing() = false, but it still has the focus)
if (currentlyFocusedComponent == child || child->isParentOf (currentlyFocusedComponent)) if (currentlyFocusedComponent == child || child->isParentOf (currentlyFocusedComponent))
{ {
const WeakReference<Component> thisPointer (this);
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
if (thisPointer == 0)
return child;
if (sendParentEvents) if (sendParentEvents)
{
const WeakReference<Component> thisPointer (this);
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
if (thisPointer == 0)
return child;
grabKeyboardFocus(); grabKeyboardFocus();
}
else
{
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
}
} }
if (sendChildEvents) if (sendChildEvents)

View file

@ -44,7 +44,7 @@ public:
MouseInputSourceInternal (MouseInputSource& source_, const int index_, const bool isMouseDevice_) MouseInputSourceInternal (MouseInputSource& source_, const int index_, const bool isMouseDevice_)
: index (index_), isMouseDevice (isMouseDevice_), source (source_), lastPeer (0), : index (index_), isMouseDevice (isMouseDevice_), source (source_), lastPeer (0),
isUnboundedMouseModeOn (false), isCursorVisibleUntilOffscreen (false), currentCursorHandle (0), isUnboundedMouseModeOn (false), isCursorVisibleUntilOffscreen (false), currentCursorHandle (0),
mouseEventCounter (0), lastTime (0) mouseEventCounter (0)
{ {
} }
@ -98,43 +98,43 @@ public:
} }
//============================================================================== //==============================================================================
void sendMouseEnter (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseEnter (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseEnter (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseEnter (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseExit (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseExit (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseExit (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseExit (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseMove (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseMove (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseMove (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseMove (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseDown (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseDown (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDown (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseDown (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseDrag (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseDrag (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDrag (source, comp->getLocalPoint (0, screenPos), time); comp->internalMouseDrag (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseUp (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseUp (Component* const comp, const Point<int>& screenPos, const Time& time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseUp (source, comp->getLocalPoint (0, screenPos), time, getCurrentModifiers()); comp->internalMouseUp (source, comp->getLocalPoint (0, screenPos), time, getCurrentModifiers());
} }
void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const int64 time, float x, float y) void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const Time& time, float x, float y)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); //DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseWheel (source, comp->getLocalPoint (0, screenPos), time, x, y); comp->internalMouseWheel (source, comp->getLocalPoint (0, screenPos), time, x, y);
@ -142,7 +142,7 @@ public:
//============================================================================== //==============================================================================
// (returns true if the button change caused a modal event loop) // (returns true if the button change caused a modal event loop)
bool setButtons (const Point<int>& screenPos, const int64 time, const ModifierKeys& newButtonState) bool setButtons (const Point<int>& screenPos, const Time& time, const ModifierKeys& newButtonState)
{ {
if (buttonState == newButtonState) if (buttonState == newButtonState)
return false; return false;
@ -186,7 +186,7 @@ public:
return lastCounter != mouseEventCounter; return lastCounter != mouseEventCounter;
} }
void setComponentUnderMouse (Component* const newComponent, const Point<int>& screenPos, const int64 time) void setComponentUnderMouse (Component* const newComponent, const Point<int>& screenPos, const Time& time)
{ {
Component* current = getComponentUnderMouse(); Component* current = getComponentUnderMouse();
@ -213,7 +213,7 @@ public:
} }
} }
void setPeer (ComponentPeer* const newPeer, const Point<int>& screenPos, const int64 time) void setPeer (ComponentPeer* const newPeer, const Point<int>& screenPos, const Time& time)
{ {
ModifierKeys::updateCurrentModifiers(); ModifierKeys::updateCurrentModifiers();
@ -225,7 +225,7 @@ public:
} }
} }
void setScreenPos (const Point<int>& newScreenPos, const int64 time, const bool forceUpdate) void setScreenPos (const Point<int>& newScreenPos, const Time& time, const bool forceUpdate)
{ {
if (! isDragging()) if (! isDragging())
setComponentUnderMouse (findComponentAt (newScreenPos), newScreenPos, time); setComponentUnderMouse (findComponentAt (newScreenPos), newScreenPos, time);
@ -258,7 +258,7 @@ public:
} }
//============================================================================== //==============================================================================
void handleEvent (ComponentPeer* const newPeer, const Point<int>& positionWithinPeer, const int64 time, const ModifierKeys& newMods) void handleEvent (ComponentPeer* const newPeer, const Point<int>& positionWithinPeer, const Time& time, const ModifierKeys& newMods)
{ {
jassert (newPeer != 0); jassert (newPeer != 0);
lastTime = time; lastTime = time;
@ -286,7 +286,7 @@ public:
} }
} }
void handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, int64 time, float x, float y) void handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, const Time& time, float x, float y)
{ {
jassert (peer != 0); jassert (peer != 0);
lastTime = time; lastTime = time;
@ -320,7 +320,7 @@ public:
{ {
int numClicks = 0; int numClicks = 0;
if (mouseDowns[0].time != 0) if (mouseDowns[0].time != Time())
{ {
if (! mouseMovedSignificantlySincePressed) if (! mouseMovedSignificantlySincePressed)
++numClicks; ++numClicks;
@ -340,7 +340,7 @@ public:
bool hasMouseMovedSignificantlySincePressed() const throw() bool hasMouseMovedSignificantlySincePressed() const throw()
{ {
return mouseMovedSignificantlySincePressed return mouseMovedSignificantlySincePressed
|| lastTime > mouseDowns[0].time + 300; || lastTime > mouseDowns[0].time + RelativeTime::milliseconds (300);
} }
//============================================================================== //==============================================================================
@ -351,7 +351,7 @@ public:
void handleAsyncUpdate() void handleAsyncUpdate()
{ {
setScreenPos (lastScreenPos, jmax (lastTime, Time::currentTimeMillis()), true); setScreenPos (lastScreenPos, jmax (lastTime, Time::getCurrentTime()), true);
} }
//============================================================================== //==============================================================================
@ -447,19 +447,18 @@ private:
struct RecentMouseDown struct RecentMouseDown
{ {
RecentMouseDown() RecentMouseDown() : component (0)
: time (0), component (0)
{ {
} }
Point<int> position; Point<int> position;
int64 time; Time time;
Component* component; Component* component;
ModifierKeys buttons; ModifierKeys buttons;
bool canBePartOfMultipleClickWith (const RecentMouseDown& other, const int maxTimeBetween) const bool canBePartOfMultipleClickWith (const RecentMouseDown& other, const int maxTimeBetweenMs) const
{ {
return time - other.time < maxTimeBetween return time - other.time < RelativeTime::milliseconds (maxTimeBetweenMs)
&& abs (position.getX() - other.position.getX()) < 8 && abs (position.getX() - other.position.getX()) < 8
&& abs (position.getY() - other.position.getY()) < 8 && abs (position.getY() - other.position.getY()) < 8
&& buttons == other.buttons;; && buttons == other.buttons;;
@ -468,9 +467,9 @@ private:
RecentMouseDown mouseDowns[4]; RecentMouseDown mouseDowns[4];
bool mouseMovedSignificantlySincePressed; bool mouseMovedSignificantlySincePressed;
int64 lastTime; Time lastTime;
void registerMouseDown (const Point<int>& screenPos, const int64 time, void registerMouseDown (const Point<int>& screenPos, const Time& time,
Component* const component, const ModifierKeys& modifiers) throw() Component* const component, const ModifierKeys& modifiers) throw()
{ {
for (int i = numElementsInArray (mouseDowns); --i > 0;) for (int i = numElementsInArray (mouseDowns); --i > 0;)
@ -526,12 +525,12 @@ void MouseInputSource::forceMouseCursorUpdate() { pimpl-
void MouseInputSource::handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, const int64 time, const ModifierKeys& mods) void MouseInputSource::handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, const int64 time, const ModifierKeys& mods)
{ {
pimpl->handleEvent (peer, positionWithinPeer, time, mods.withOnlyMouseButtons()); pimpl->handleEvent (peer, positionWithinPeer, Time (time), mods.withOnlyMouseButtons());
} }
void MouseInputSource::handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, const int64 time, const float x, const float y) void MouseInputSource::handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, const int64 time, const float x, const float y)
{ {
pimpl->handleWheel (peer, positionWithinPeer, time, x, y); pimpl->handleWheel (peer, positionWithinPeer, Time (time), x, y);
} }

View file

@ -105,7 +105,7 @@ public:
/** When evaluating an Expression object, this class is used to resolve symbols and /** When evaluating an Expression object, this class is used to resolve symbols and
perform functions that the expression uses. perform functions that the expression uses.
*/ */
class EvaluationContext class JUCE_API EvaluationContext
{ {
public: public:
EvaluationContext(); EvaluationContext();

View file

@ -107,7 +107,8 @@ private:
}; };
//============================================================================== //==============================================================================
#if DOXYGEN || (JUCE_CHECK_MEMORY_LEAKS && ! defined (JUCE_LEAK_DETECTOR)) #if DOXYGEN || ! defined (JUCE_LEAK_DETECTOR)
#if (DOXYGEN || JUCE_CHECK_MEMORY_LEAKS)
/** This macro lets you embed a leak-detecting object inside a class. /** This macro lets you embed a leak-detecting object inside a class.
To use it, simply declare a JUCE_LEAK_DETECTOR(YourClassName) inside a private section To use it, simply declare a JUCE_LEAK_DETECTOR(YourClassName) inside a private section
@ -127,8 +128,9 @@ private:
@see JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, LeakedObjectDetector @see JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, LeakedObjectDetector
*/ */
#define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__); #define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__);
#else #else
#define JUCE_LEAK_DETECTOR(OwnerClass) #define JUCE_LEAK_DETECTOR(OwnerClass)
#endif
#endif #endif

View file

@ -250,6 +250,24 @@ namespace
return statfs (f.getFullPathName().toUTF8(), &result) == 0; return statfs (f.getFullPathName().toUTF8(), &result) == 0;
} }
void updateStatInfoForFile (const String& path, bool* const isDir, int64* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly)
{
if (isDir != 0 || fileSize != 0 || modTime != 0 || creationTime != 0)
{
juce_statStruct info;
const bool statOk = juce_stat (path, info);
if (isDir != 0) *isDir = statOk && ((info.st_mode & S_IFDIR) != 0);
if (fileSize != 0) *fileSize = statOk ? info.st_size : 0;
if (modTime != 0) *modTime = Time (statOk ? (int64) info.st_mtime * 1000 : 0);
if (creationTime != 0) *creationTime = Time (statOk ? (int64) info.st_ctime * 1000 : 0);
}
if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;
}
} }
bool File::isDirectory() const bool File::isDirectory() const

View file

@ -236,9 +236,6 @@ public:
wildCard (wildCard_), wildCard (wildCard_),
dir (opendir (directory.getFullPathName().toUTF8())) dir (opendir (directory.getFullPathName().toUTF8()))
{ {
if (wildCard == "*.*")
wildCard = "*";
wildcardUTF8 = wildCard.toUTF8(); wildcardUTF8 = wildCard.toUTF8();
} }
@ -252,41 +249,30 @@ public:
bool* const isDir, bool* const isHidden, int64* const fileSize, bool* const isDir, bool* const isHidden, int64* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly) Time* const modTime, Time* const creationTime, bool* const isReadOnly)
{ {
if (dir == 0) if (dir != 0)
return false;
for (;;)
{ {
struct dirent* const de = readdir (dir); for (;;)
if (de == 0)
return false;
if (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0)
{ {
filenameFound = String::fromUTF8 (de->d_name); struct dirent* const de = readdir (dir);
const String path (parentDir + filenameFound);
if (isDir != 0 || fileSize != 0 || modTime != 0 || creationTime != 0) if (de == 0)
break;
if (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0)
{ {
struct stat info; filenameFound = String::fromUTF8 (de->d_name);
const bool statOk = juce_stat (path, info);
if (isDir != 0) *isDir = statOk && ((info.st_mode & S_IFDIR) != 0); updateStatInfoForFile (parentDir + filenameFound, isDir, fileSize, modTime, creationTime, isReadOnly);
if (fileSize != 0) *fileSize = statOk ? info.st_size : 0;
if (modTime != 0) *modTime = statOk ? (int64) info.st_mtime * 1000 : 0; if (isHidden != 0)
if (creationTime != 0) *creationTime = statOk ? (int64) info.st_ctime * 1000 : 0; *isHidden = filenameFound.startsWithChar ('.');
return true;
} }
if (isHidden != 0)
*isHidden = filenameFound.startsWithChar ('.');
if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;
return true;
} }
} }
return false;
} }
private: private:

View file

@ -356,24 +356,11 @@ public:
continue; continue;
const String path (parentDir + filenameFound); const String path (parentDir + filenameFound);
updateStatInfoForFile (path, isDir, fileSize, modTime, creationTime, isReadOnly);
if (isDir != 0 || fileSize != 0 || modTime != 0 || creationTime != 0)
{
juce_statStruct info;
const bool statOk = juce_stat (path, info);
if (isDir != 0) *isDir = statOk && ((info.st_mode & S_IFDIR) != 0);
if (fileSize != 0) *fileSize = statOk ? info.st_size : 0;
if (modTime != 0) *modTime = statOk ? (int64) info.st_mtime * 1000 : 0;
if (creationTime != 0) *creationTime = statOk ? (int64) info.st_ctime * 1000 : 0;
}
if (isHidden != 0) if (isHidden != 0)
*isHidden = FileHelpers::isHiddenFile (path); *isHidden = FileHelpers::isHiddenFile (path);
if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;
return true; return true;
} }
} }

View file

@ -88,7 +88,7 @@
#include <GLUT/glut.h> #include <GLUT/glut.h>
#endif #endif
#if ! (CGFLOAT_DEFINED || defined (DOXYGEN)) #if ! CGFLOAT_DEFINED
#define CGFloat float #define CGFloat float
#endif #endif

View file

@ -586,8 +586,8 @@ public:
if (isDir != 0) *isDir = ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); if (isDir != 0) *isDir = ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0);
if (isHidden != 0) *isHidden = ((findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0); if (isHidden != 0) *isHidden = ((findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0);
if (fileSize != 0) *fileSize = findData.nFileSizeLow + (((int64) findData.nFileSizeHigh) << 32); if (fileSize != 0) *fileSize = findData.nFileSizeLow + (((int64) findData.nFileSizeHigh) << 32);
if (modTime != 0) *modTime = fileTimeToTime (&findData.ftLastWriteTime); if (modTime != 0) *modTime = Time (fileTimeToTime (&findData.ftLastWriteTime));
if (creationTime != 0) *creationTime = fileTimeToTime (&findData.ftCreationTime); if (creationTime != 0) *creationTime = Time (fileTimeToTime (&findData.ftCreationTime));
if (isReadOnly != 0) *isReadOnly = ((findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) != 0); if (isReadOnly != 0) *isReadOnly = ((findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) != 0);
return true; return true;

View file

@ -37,11 +37,6 @@
#endif #endif
//============================================================================== //==============================================================================
struct ConnectionAndRequestStruct
{
HINTERNET connection, request;
};
static HINTERNET sessionHandle = 0; static HINTERNET sessionHandle = 0;
#ifndef WORKAROUND_TIMEOUT_BUG #ifndef WORKAROUND_TIMEOUT_BUG
@ -304,7 +299,6 @@ private:
buffers.lpcszHeader = static_cast <LPCTSTR> (headers); buffers.lpcszHeader = static_cast <LPCTSTR> (headers);
buffers.dwHeadersLength = headers.length(); buffers.dwHeadersLength = headers.length();
buffers.dwBufferTotal = (DWORD) postData.getSize(); buffers.dwBufferTotal = (DWORD) postData.getSize();
ConnectionAndRequestStruct* result = 0;
if (HttpSendRequestEx (request, &buffers, 0, HSR_INITIATE, 0)) if (HttpSendRequestEx (request, &buffers, 0, HSR_INITIATE, 0))
{ {

View file

@ -923,7 +923,7 @@ public:
} }
} }
void handleTaskBarEvent (const LPARAM lParam, const WPARAM wParam) void handleTaskBarEvent (const LPARAM lParam)
{ {
if (component->isCurrentlyBlockedByAnotherModalComponent()) if (component->isCurrentlyBlockedByAnotherModalComponent())
{ {
@ -948,8 +948,8 @@ public:
eventMods = eventMods.withoutMouseButtons(); eventMods = eventMods.withoutMouseButtons();
const MouseEvent e (Desktop::getInstance().getMainMouseSource(), const MouseEvent e (Desktop::getInstance().getMainMouseSource(),
Point<int>(), eventMods, component, component, getMouseEventTime(), Point<int>(), eventMods, component, component, Time (getMouseEventTime()),
Point<int>(), getMouseEventTime(), 1, false); Point<int>(), Time (getMouseEventTime()), 1, false);
if (lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN) if (lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN)
{ {
@ -2180,7 +2180,7 @@ private:
return TRUE; return TRUE;
case WM_TRAYNOTIFY: case WM_TRAYNOTIFY:
handleTaskBarEvent (lParam, wParam); handleTaskBarEvent (lParam);
break; break;
case WM_SYNCPAINT: case WM_SYNCPAINT:

View file

@ -296,6 +296,7 @@ private:
const int threadStopTimeout; const int threadStopTimeout;
int priority; int priority;
class ThreadPoolThread; class ThreadPoolThread;
friend class OwnedArray <ThreadPoolThread>;
OwnedArray <ThreadPoolThread> threads; OwnedArray <ThreadPoolThread> threads;
Array <ThreadPoolJob*> jobs; Array <ThreadPoolJob*> jobs;