Browse Source

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

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
ece4205d3d
24 changed files with 415 additions and 534 deletions
  1. +1
    -1
      extras/juce demo/Source/demos/QuickTimeDemo.cpp
  2. +155
    -193
      juce_amalgamated.cpp
  3. +57
    -72
      juce_amalgamated.h
  4. +1
    -1
      src/audio/plugins/formats/juce_AudioUnitPluginFormat.mm
  5. +2
    -2
      src/audio/plugins/juce_KnownPluginList.cpp
  6. +42
    -102
      src/core/juce_RelativeTime.cpp
  7. +21
    -39
      src/core/juce_RelativeTime.h
  8. +1
    -1
      src/core/juce_StandardHeader.h
  9. +17
    -0
      src/core/juce_Time.cpp
  10. +32
    -30
      src/core/juce_Time.h
  11. +1
    -1
      src/events/juce_Timer.cpp
  12. +1
    -1
      src/gui/components/buttons/juce_Button.h
  13. +12
    -6
      src/gui/components/juce_Component.cpp
  14. +25
    -26
      src/gui/components/mouse/juce_MouseInputSource.cpp
  15. +1
    -1
      src/maths/juce_Expression.h
  16. +4
    -2
      src/memory/juce_LeakedObjectDetector.h
  17. +18
    -0
      src/native/common/juce_posix_SharedCode.h
  18. +15
    -29
      src/native/linux/juce_linux_Files.cpp
  19. +1
    -14
      src/native/mac/juce_mac_Files.mm
  20. +1
    -1
      src/native/mac/juce_mac_NativeIncludes.h
  21. +2
    -2
      src/native/windows/juce_win32_Files.cpp
  22. +0
    -6
      src/native/windows/juce_win32_Network.cpp
  23. +4
    -4
      src/native/windows/juce_win32_Windowing.cpp
  24. +1
    -0
      src/threads/juce_ThreadPool.h

+ 1
- 1
extras/juce demo/Source/demos/QuickTimeDemo.cpp View File

@@ -35,7 +35,7 @@ class QuickTimeWindowWithFileBrowser : public Component,
public:
QuickTimeWindowWithFileBrowser()
: 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);


+ 155
- 193
juce_amalgamated.cpp View File

@@ -915,7 +915,7 @@ protected:
#include <GLUT/glut.h>
#endif

#if ! (CGFLOAT_DEFINED || defined (DOXYGEN))
#if ! CGFLOAT_DEFINED
#define CGFloat float
#endif

@@ -1492,60 +1492,18 @@ RelativeTime::~RelativeTime() 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);
}

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);
}
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); }
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)); }

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);
}
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
{
@@ -1553,65 +1511,63 @@ const String RelativeTime::getDescription (const String& returnValueForZeroTime)
return returnValueForZeroTime;

String result;
result.preallocateStorage (16);

if (seconds < 0)
result = "-";
result << '-';

int fieldsShown = 0;
int n = abs ((int) inWeeks());
int n = std::abs ((int) inWeeks());
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" week ")
: TRANS(" weeks "));
result << n << (n == 1 ? TRANS(" week ")
: TRANS(" weeks "));
++fieldsShown;
}

n = abs ((int) inDays()) % 7;
n = std::abs ((int) inDays()) % 7;
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" day ")
: TRANS(" days "));
result << n << (n == 1 ? TRANS(" day ")
: TRANS(" days "));
++fieldsShown;
}

if (fieldsShown < 2)
{
n = abs ((int) inHours()) % 24;
n = std::abs ((int) inHours()) % 24;
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" hr ")
: TRANS(" hrs "));
result << n << (n == 1 ? TRANS(" hr ")
: TRANS(" hrs "));
++fieldsShown;
}

if (fieldsShown < 2)
{
n = abs ((int) inMinutes()) % 60;
n = std::abs ((int) inMinutes()) % 60;
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" min ")
: TRANS(" mins "));
result << n << (n == 1 ? TRANS(" min ")
: TRANS(" mins "));
++fieldsShown;
}

if (fieldsShown < 2)
{
n = abs ((int) inSeconds()) % 60;
n = std::abs ((int) inSeconds()) % 60;
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" sec ")
: TRANS(" secs "));
result << n << (n == 1 ? TRANS(" sec ")
: TRANS(" secs "));
++fieldsShown;
}

if (fieldsShown < 1)
if (fieldsShown == 0)
{
n = abs ((int) inMilliseconds()) % 1000;
n = std::abs ((int) inMilliseconds()) % 1000;
if (n > 0)
{
result << n << TRANS(" ms");
++fieldsShown;
}
}
}
}
@@ -1626,33 +1582,6 @@ RelativeTime& RelativeTime::operator= (const RelativeTime& other) throw()
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()
{
seconds += timeToAdd.seconds;
@@ -1677,6 +1606,16 @@ const RelativeTime& RelativeTime::operator-= (const double secondsToSubtract) th
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 of inlined file: juce_RelativeTime.cpp ***/

@@ -2169,6 +2108,21 @@ const String Time::getWeekdayName (int day, const bool threeLetterVersion)
: 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 of inlined file: juce_Time.cpp ***/

@@ -30537,12 +30491,12 @@ namespace
if (fileOrIdentifier.startsWithChar ('/') || fileOrIdentifier[1] == ':')
return File (fileOrIdentifier).getLastModificationTime();

return Time (0);
return Time();
}

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)
^ ((int) componentDesc.componentSubType)
^ ((int) componentDesc.componentManufacturer);
desc.lastFileModTime = 0;
desc.lastFileModTime = Time();
desc.pluginFormatName = "AudioUnit";
desc.category = getCategory();
desc.manufacturerName = manufacturer;
@@ -39723,7 +39677,7 @@ private:
startThread (7);
}

JUCE_DECLARE_NON_COPYABLE (InternalTimerThread);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InternalTimerThread);
};

InternalTimerThread* InternalTimerThread::instance = 0;
@@ -41120,18 +41074,24 @@ Component* Component::removeChildComponent (const int index, bool sendParentEven
childComponentList_.remove (index);
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))
{
const WeakReference<Component> thisPointer (this);
if (sendParentEvents)
{
const WeakReference<Component> thisPointer (this);

giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);

if (thisPointer == 0)
return child;
if (thisPointer == 0)
return child;

if (sendParentEvents)
grabKeyboardFocus();
}
else
{
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
}
}

if (sendChildEvents)
@@ -71191,7 +71151,7 @@ public:
MouseInputSourceInternal (MouseInputSource& source_, const int index_, const bool isMouseDevice_)
: index (index_), isMouseDevice (isMouseDevice_), source (source_), lastPeer (0),
isUnboundedMouseModeOn (false), isCursorVisibleUntilOffscreen (false), currentCursorHandle (0),
mouseEventCounter (0), lastTime (0)
mouseEventCounter (0)
{
}

@@ -71243,50 +71203,50 @@ public:
: 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));
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));
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));
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));
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));
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));
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));
comp->internalMouseWheel (source, comp->getLocalPoint (0, screenPos), time, x, y);
}

// (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)
return false;
@@ -71330,7 +71290,7 @@ public:
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();

@@ -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();

@@ -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())
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);
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);
lastTime = time;
@@ -71462,7 +71422,7 @@ public:
{
int numClicks = 0;

if (mouseDowns[0].time != 0)
if (mouseDowns[0].time != Time())
{
if (! mouseMovedSignificantlySincePressed)
++numClicks;
@@ -71482,7 +71442,7 @@ public:
bool hasMouseMovedSignificantlySincePressed() const throw()
{
return mouseMovedSignificantlySincePressed
|| lastTime > mouseDowns[0].time + 300;
|| lastTime > mouseDowns[0].time + RelativeTime::milliseconds (300);
}

void triggerFakeMove()
@@ -71492,7 +71452,7 @@ public:

void handleAsyncUpdate()
{
setScreenPos (lastScreenPos, jmax (lastTime, Time::currentTimeMillis()), true);
setScreenPos (lastScreenPos, jmax (lastTime, Time::getCurrentTime()), true);
}

void enableUnboundedMouseMovement (bool enable, bool keepCursorVisibleUntilOffscreen)
@@ -71585,19 +71545,18 @@ private:

struct RecentMouseDown
{
RecentMouseDown()
: time (0), component (0)
RecentMouseDown() : component (0)
{
}

Point<int> position;
int64 time;
Time time;
Component* component;
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.getY() - other.position.getY()) < 8
&& buttons == other.buttons;;
@@ -71606,9 +71565,9 @@ private:

RecentMouseDown mouseDowns[4];
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()
{
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)
{
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)
{
pimpl->handleWheel (peer, positionWithinPeer, time, x, y);
pimpl->handleWheel (peer, positionWithinPeer, Time (time), x, y);
}

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

return true;
@@ -239173,11 +239132,6 @@ void NamedPipe::cancelPendingReads()
#define INTERNET_OPTION_DISABLE_AUTODIAL 70
#endif

struct ConnectionAndRequestStruct
{
HINTERNET connection, request;
};

static HINTERNET sessionHandle = 0;

#ifndef WORKAROUND_TIMEOUT_BUG
@@ -239437,7 +239391,6 @@ private:
buffers.lpcszHeader = static_cast <LPCTSTR> (headers);
buffers.dwHeadersLength = headers.length();
buffers.dwBufferTotal = (DWORD) postData.getSize();
ConnectionAndRequestStruct* result = 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())
{
@@ -242282,8 +242235,8 @@ public:
eventMods = eventMods.withoutMouseButtons();

const MouseEvent e (Desktop::getInstance().getMainMouseSource(),
Point<int>(), eventMods, component, component, getMouseEventTime(),
Point<int>(), getMouseEventTime(), 1, false);
Point<int>(), eventMods, component, component, Time (getMouseEventTime()),
Point<int>(), Time (getMouseEventTime()), 1, false);

if (lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN)
{
@@ -243495,7 +243448,7 @@ private:
return TRUE;

case WM_TRAYNOTIFY:
handleTaskBarEvent (lParam, wParam);
handleTaskBarEvent (lParam);
break;

case WM_SYNCPAINT:
@@ -253813,6 +253766,24 @@ namespace

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
@@ -254519,9 +254490,6 @@ public:
wildCard (wildCard_),
dir (opendir (directory.getFullPathName().toUTF8()))
{
if (wildCard == "*.*")
wildCard = "*";

wildcardUTF8 = wildCard.toUTF8();
}

@@ -254535,41 +254503,30 @@ public:
bool* const isDir, bool* const isHidden, int64* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly)
{
if (dir == 0)
return false;

for (;;)
if (dir != 0)
{
struct dirent* const de = readdir (dir);

if (de == 0)
return false;

if (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0)
for (;;)
{
filenameFound = String::fromUTF8 (de->d_name);
const String path (parentDir + filenameFound);
struct dirent* const de = readdir (dir);

if (isDir != 0 || fileSize != 0 || modTime != 0 || creationTime != 0)
{
struct stat info;
const bool statOk = juce_stat (path, info);
if (de == 0)
break;

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 (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0)
{
filenameFound = String::fromUTF8 (de->d_name);

if (isHidden != 0)
*isHidden = filenameFound.startsWithChar ('.');
updateStatInfoForFile (parentDir + filenameFound, isDir, fileSize, modTime, creationTime, isReadOnly);

if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;
if (isHidden != 0)
*isHidden = filenameFound.startsWithChar ('.');

return true;
return true;
}
}
}

return false;
}

private:
@@ -263681,6 +263638,24 @@ namespace

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
@@ -264506,24 +264481,11 @@ public:
continue;

const String path (parentDir + filenameFound);

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;
}
updateStatInfoForFile (path, isDir, fileSize, modTime, creationTime, isReadOnly);

if (isHidden != 0)
*isHidden = FileHelpers::isHiddenFile (path);

if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;

return true;
}
}


+ 57
- 72
juce_amalgamated.h View File

@@ -64,7 +64,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 109
#define JUCE_BUILDNUMBER 110

/** 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.

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
*/
#define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__);
#else
#else
#define JUCE_LEAK_DETECTOR(OwnerClass)
#endif
#endif

#endif // __JUCE_LEAKEDOBJECTDETECTOR_JUCEHEADER__
@@ -7885,73 +7887,61 @@ public:
~RelativeTime() throw();

/** Creates a new RelativeTime object representing a number of milliseconds.

@see minutes, hours, days, weeks
*/
static const RelativeTime milliseconds (int milliseconds) throw();

/** Creates a new RelativeTime object representing a number of milliseconds.

@see minutes, hours, days, weeks
*/
static const RelativeTime milliseconds (int64 milliseconds) throw();

/** Creates a new RelativeTime object representing a number of minutes.

@see milliseconds, hours, days, weeks
*/
static const RelativeTime minutes (double numberOfMinutes) throw();

/** Creates a new RelativeTime object representing a number of hours.

@see milliseconds, minutes, days, weeks
*/
static const RelativeTime hours (double numberOfHours) throw();

/** Creates a new RelativeTime object representing a number of days.

@see milliseconds, minutes, hours, weeks
*/
static const RelativeTime days (double numberOfDays) throw();

/** Creates a new RelativeTime object representing a number of weeks.

@see milliseconds, minutes, hours, days
*/
static const RelativeTime weeks (double numberOfWeeks) throw();

/** Returns the number of milliseconds this time represents.

@see milliseconds, inSeconds, inMinutes, inHours, inDays, inWeeks
*/
int64 inMilliseconds() const throw();

/** Returns the number of seconds this time represents.

@see inMilliseconds, inMinutes, inHours, inDays, inWeeks
*/
double inSeconds() const throw() { return seconds; }

/** Returns the number of minutes this time represents.

@see inMilliseconds, inSeconds, inHours, inDays, inWeeks
*/
double inMinutes() const throw();

/** Returns the number of hours this time represents.

@see inMilliseconds, inSeconds, inMinutes, inDays, inWeeks
*/
double inHours() const throw();

/** Returns the number of days this time represents.

@see inMilliseconds, inSeconds, inMinutes, inHours, inWeeks
*/
double inDays() const throw();

/** Returns the number of weeks this time represents.

@see inMilliseconds, inSeconds, inMinutes, inHours, inDays
*/
double inWeeks() const throw();
@@ -7973,30 +7963,6 @@ public:
*/
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. */
const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
/** Subtracts another RelativeTime from this one. */
@@ -8004,7 +7970,6 @@ public:

/** Adds a number of seconds to this time. */
const RelativeTime& operator+= (double secondsToAdd) throw();

/** Subtracts a number of seconds from this time. */
const RelativeTime& operator-= (double secondsToSubtract) throw();

@@ -8013,6 +7978,24 @@ private:
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__
/*** End of inlined file: juce_RelativeTime.h ***/

@@ -8038,9 +8021,6 @@ public:
*/
Time() throw();

/** Creates a copy of another Time object. */
Time (const Time& other) throw();

/** Creates a time based on a number of milliseconds.

The internal millisecond count is set to 0 (1st January 1970). To create a
@@ -8050,7 +8030,7 @@ public:
'epoch' (midnight Jan 1st 1970).
@see getCurrentTime, currentTimeMillis
*/
Time (int64 millisecondsSinceEpoch) throw();
explicit Time (int64 millisecondsSinceEpoch) throw();

/** Creates a time from a set of date components.

@@ -8075,6 +8055,9 @@ public:
int milliseconds = 0,
bool useLocalTime = true) throw();

/** Creates a copy of another Time object. */
Time (const Time& other) throw();

/** Destructor. */
~Time() throw();

@@ -8231,32 +8214,10 @@ public:
*/
const String formatted (const String& format) const;

/** Adds a RelativeTime to this time and returns the result. */
const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }

/** Subtracts a RelativeTime from this time and returns the result. */
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; }
/** Adds a RelativeTime to this time. */
Time& operator+= (const RelativeTime& delta);
/** Subtracts a RelativeTime from this time. */
Time& operator-= (const RelativeTime& delta);

/** Tries to set the computer's clock.

@@ -8368,6 +8329,29 @@ private:
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__
/*** 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
perform functions that the expression uses.
*/
class EvaluationContext
class JUCE_API EvaluationContext
{
public:
EvaluationContext();
@@ -19386,6 +19370,7 @@ private:
const int threadStopTimeout;
int priority;
class ThreadPoolThread;
friend class OwnedArray <ThreadPoolThread>;
OwnedArray <ThreadPoolThread> threads;
Array <ThreadPoolJob*> jobs;

@@ -36591,7 +36576,7 @@ public:

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


+ 1
- 1
src/audio/plugins/formats/juce_AudioUnitPluginFormat.mm View File

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


+ 2
- 2
src/audio/plugins/juce_KnownPluginList.cpp View File

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


+ 42
- 102
src/core/juce_RelativeTime.cpp View File

@@ -47,127 +47,84 @@ RelativeTime::~RelativeTime() 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);
}
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 int milliseconds) throw() { return RelativeTime (milliseconds * 0.001); }
const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) throw() { 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()
{
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);
}
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
{
if (seconds < 0.001 && seconds > -0.001)
return returnValueForZeroTime;
String result;
result.preallocateStorage (16);
if (seconds < 0)
result = "-";
result << '-';
int fieldsShown = 0;
int n = abs ((int) inWeeks());
int n = std::abs ((int) inWeeks());
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" week ")
: TRANS(" weeks "));
result << n << (n == 1 ? TRANS(" week ")
: TRANS(" weeks "));
++fieldsShown;
}
n = abs ((int) inDays()) % 7;
n = std::abs ((int) inDays()) % 7;
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" day ")
: TRANS(" days "));
result << n << (n == 1 ? TRANS(" day ")
: TRANS(" days "));
++fieldsShown;
}
if (fieldsShown < 2)
{
n = abs ((int) inHours()) % 24;
n = std::abs ((int) inHours()) % 24;
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" hr ")
: TRANS(" hrs "));
result << n << (n == 1 ? TRANS(" hr ")
: TRANS(" hrs "));
++fieldsShown;
}
if (fieldsShown < 2)
{
n = abs ((int) inMinutes()) % 60;
n = std::abs ((int) inMinutes()) % 60;
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" min ")
: TRANS(" mins "));
result << n << (n == 1 ? TRANS(" min ")
: TRANS(" mins "));
++fieldsShown;
}
if (fieldsShown < 2)
{
n = abs ((int) inSeconds()) % 60;
n = std::abs ((int) inSeconds()) % 60;
if (n > 0)
{
result << n << ((n == 1) ? TRANS(" sec ")
: TRANS(" secs "));
result << n << (n == 1 ? TRANS(" sec ")
: TRANS(" secs "));
++fieldsShown;
}
if (fieldsShown < 1)
if (fieldsShown == 0)
{
n = abs ((int) inMilliseconds()) % 1000;
n = std::abs ((int) inMilliseconds()) % 1000;
if (n > 0)
{
result << n << TRANS(" ms");
++fieldsShown;
}
}
}
}
@@ -183,34 +140,6 @@ RelativeTime& RelativeTime::operator= (const RelativeTime& other) throw()
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()
{
@@ -236,4 +165,15 @@ const RelativeTime& RelativeTime::operator-= (const double secondsToSubtract) th
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

+ 21
- 39
src/core/juce_RelativeTime.h View File

@@ -59,74 +59,62 @@ public:
//==============================================================================
/** Creates a new RelativeTime object representing a number of milliseconds.
@see minutes, hours, days, weeks
*/
static const RelativeTime milliseconds (int milliseconds) throw();
/** Creates a new RelativeTime object representing a number of milliseconds.
@see minutes, hours, days, weeks
*/
static const RelativeTime milliseconds (int64 milliseconds) throw();
/** Creates a new RelativeTime object representing a number of minutes.
@see milliseconds, hours, days, weeks
*/
static const RelativeTime minutes (double numberOfMinutes) throw();
/** Creates a new RelativeTime object representing a number of hours.
@see milliseconds, minutes, days, weeks
*/
static const RelativeTime hours (double numberOfHours) throw();
/** Creates a new RelativeTime object representing a number of days.
@see milliseconds, minutes, hours, weeks
*/
static const RelativeTime days (double numberOfDays) throw();
/** Creates a new RelativeTime object representing a number of weeks.
@see milliseconds, minutes, hours, days
*/
static const RelativeTime weeks (double numberOfWeeks) throw();
//==============================================================================
/** Returns the number of milliseconds this time represents.
@see milliseconds, inSeconds, inMinutes, inHours, inDays, inWeeks
*/
int64 inMilliseconds() const throw();
/** Returns the number of seconds this time represents.
@see inMilliseconds, inMinutes, inHours, inDays, inWeeks
*/
double inSeconds() const throw() { return seconds; }
/** Returns the number of minutes this time represents.
@see inMilliseconds, inSeconds, inHours, inDays, inWeeks
*/
double inMinutes() const throw();
/** Returns the number of hours this time represents.
@see inMilliseconds, inSeconds, inMinutes, inDays, inWeeks
*/
double inHours() const throw();
/** Returns the number of days this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inWeeks
*/
double inDays() const throw();
/** Returns the number of weeks this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inDays
*/
double inWeeks() const throw();
@@ -148,33 +136,8 @@ public:
*/
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. */
const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
/** Subtracts another RelativeTime from this one. */
@@ -182,15 +145,34 @@ public:
/** Adds a number of seconds to this time. */
const RelativeTime& operator+= (double secondsToAdd) throw();
/** Subtracts a number of seconds from this time. */
const RelativeTime& operator-= (double secondsToSubtract) throw();
private:
//==============================================================================
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__

+ 1
- 1
src/core/juce_StandardHeader.h View File

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


+ 17
- 0
src/core/juce_Time.cpp View File

@@ -496,4 +496,21 @@ const String Time::getWeekdayName (int day, const bool threeLetterVersion)
: 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

+ 32
- 30
src/core/juce_Time.h View File

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

+ 1
- 1
src/events/juce_Timer.cpp View File

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


+ 1
- 1
src/gui/components/buttons/juce_Button.h View File

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


+ 12
- 6
src/gui/components/juce_Component.cpp View File

@@ -1368,18 +1368,24 @@ Component* Component::removeChildComponent (const int index, bool sendParentEven
childComponentList_.remove (index);
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))
{
const WeakReference<Component> thisPointer (this);
if (sendParentEvents)
{
const WeakReference<Component> thisPointer (this);
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
if (thisPointer == 0)
return child;
if (thisPointer == 0)
return child;
if (sendParentEvents)
grabKeyboardFocus();
}
else
{
giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child);
}
}
if (sendChildEvents)


+ 25
- 26
src/gui/components/mouse/juce_MouseInputSource.cpp View File

@@ -44,7 +44,7 @@ public:
MouseInputSourceInternal (MouseInputSource& source_, const int index_, const bool isMouseDevice_)
: index (index_), isMouseDevice (isMouseDevice_), source (source_), lastPeer (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));
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));
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));
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));
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));
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));
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));
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)
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)
return false;
@@ -186,7 +186,7 @@ public:
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();
@@ -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();
@@ -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())
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);
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);
lastTime = time;
@@ -320,7 +320,7 @@ public:
{
int numClicks = 0;
if (mouseDowns[0].time != 0)
if (mouseDowns[0].time != Time())
{
if (! mouseMovedSignificantlySincePressed)
++numClicks;
@@ -340,7 +340,7 @@ public:
bool hasMouseMovedSignificantlySincePressed() const throw()
{
return mouseMovedSignificantlySincePressed
|| lastTime > mouseDowns[0].time + 300;
|| lastTime > mouseDowns[0].time + RelativeTime::milliseconds (300);
}
//==============================================================================
@@ -351,7 +351,7 @@ public:
void handleAsyncUpdate()
{
setScreenPos (lastScreenPos, jmax (lastTime, Time::currentTimeMillis()), true);
setScreenPos (lastScreenPos, jmax (lastTime, Time::getCurrentTime()), true);
}
//==============================================================================
@@ -447,19 +447,18 @@ private:
struct RecentMouseDown
{
RecentMouseDown()
: time (0), component (0)
RecentMouseDown() : component (0)
{
}
Point<int> position;
int64 time;
Time time;
Component* component;
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.getY() - other.position.getY()) < 8
&& buttons == other.buttons;;
@@ -468,9 +467,9 @@ private:
RecentMouseDown mouseDowns[4];
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()
{
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)
{
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)
{
pimpl->handleWheel (peer, positionWithinPeer, time, x, y);
pimpl->handleWheel (peer, positionWithinPeer, Time (time), x, y);
}


+ 1
- 1
src/maths/juce_Expression.h View File

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


+ 4
- 2
src/memory/juce_LeakedObjectDetector.h 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.
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
*/
#define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__);
#else
#else
#define JUCE_LEAK_DETECTOR(OwnerClass)
#endif
#endif


+ 18
- 0
src/native/common/juce_posix_SharedCode.h View File

@@ -250,6 +250,24 @@ namespace
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


+ 15
- 29
src/native/linux/juce_linux_Files.cpp View File

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


+ 1
- 14
src/native/mac/juce_mac_Files.mm View File

@@ -356,24 +356,11 @@ public:
continue;
const String path (parentDir + filenameFound);
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;
}
updateStatInfoForFile (path, isDir, fileSize, modTime, creationTime, isReadOnly);
if (isHidden != 0)
*isHidden = FileHelpers::isHiddenFile (path);
if (isReadOnly != 0)
*isReadOnly = access (path.toUTF8(), W_OK) != 0;
return true;
}
}


+ 1
- 1
src/native/mac/juce_mac_NativeIncludes.h View File

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


+ 2
- 2
src/native/windows/juce_win32_Files.cpp View File

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


+ 0
- 6
src/native/windows/juce_win32_Network.cpp View File

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


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

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


+ 1
- 0
src/threads/juce_ThreadPool.h View File

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


Loading…
Cancel
Save