- updated
git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@117 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -39,6 +39,7 @@ namespace juce
|
||||
#include "messages/juce_NotificationType.h"
|
||||
#include "messages/juce_ApplicationBase.h"
|
||||
#include "messages/juce_Initialisation.h"
|
||||
#include "messages/juce_MountedVolumeListChangeDetector.h"
|
||||
#include "broadcasters/juce_ListenerList.h"
|
||||
#include "broadcasters/juce_ActionBroadcaster.h"
|
||||
#include "broadcasters/juce_ActionListener.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "juce_events",
|
||||
"name": "JUCE message and event handling classes",
|
||||
"version": "3.0.8",
|
||||
"version": "3.1.1",
|
||||
"description": "Classes for running an application's main event loop and sending/receiving messages, timers, etc.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
||||
@@ -42,7 +42,7 @@ bool MessageManager::postMessageToSystemQueue (MessageManager::MessageBase* cons
|
||||
return true;
|
||||
}
|
||||
|
||||
JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, deliverMessage, void, (jobject activity, jlong value))
|
||||
JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, deliverMessage, void, (JNIEnv* env, jobject activity, jlong value))
|
||||
{
|
||||
JUCE_TRY
|
||||
{
|
||||
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
juce_DeclareSingleton_SingleThreaded_Minimal (InternalMessageQueue);
|
||||
juce_DeclareSingleton_SingleThreaded_Minimal (InternalMessageQueue)
|
||||
|
||||
private:
|
||||
CriticalSection lock;
|
||||
@@ -209,7 +209,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
juce_ImplementSingleton_SingleThreaded (InternalMessageQueue);
|
||||
juce_ImplementSingleton_SingleThreaded (InternalMessageQueue)
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -365,3 +365,54 @@ void repostCurrentNSEvent()
|
||||
|
||||
(new EventReposter())->post();
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
#if JUCE_MAC
|
||||
struct MountedVolumeListChangeDetector::Pimpl
|
||||
{
|
||||
Pimpl (MountedVolumeListChangeDetector& d) : owner (d)
|
||||
{
|
||||
static ObserverClass cls;
|
||||
delegate = [cls.createInstance() init];
|
||||
ObserverClass::setOwner (delegate, this);
|
||||
|
||||
NSNotificationCenter* nc = [[NSWorkspace sharedWorkspace] notificationCenter];
|
||||
|
||||
[nc addObserver: delegate selector: @selector (changed:) name: NSWorkspaceDidMountNotification object: nil];
|
||||
[nc addObserver: delegate selector: @selector (changed:) name: NSWorkspaceDidUnmountNotification object: nil];
|
||||
}
|
||||
|
||||
~Pimpl()
|
||||
{
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver: delegate];
|
||||
[delegate release];
|
||||
}
|
||||
|
||||
private:
|
||||
MountedVolumeListChangeDetector& owner;
|
||||
id delegate;
|
||||
|
||||
struct ObserverClass : public ObjCClass<NSObject>
|
||||
{
|
||||
ObserverClass() : ObjCClass<NSObject> ("JUCEDriveObserver_")
|
||||
{
|
||||
addIvar<Pimpl*> ("owner");
|
||||
addMethod (@selector (changed:), changed, "v@:@");
|
||||
addProtocol (@protocol (NSTextInput));
|
||||
registerClass();
|
||||
}
|
||||
|
||||
static Pimpl* getOwner (id self) { return getIvar<Pimpl*> (self, "owner"); }
|
||||
static void setOwner (id self, Pimpl* owner) { object_setInstanceVariable (self, "owner", owner); }
|
||||
|
||||
static void changed (id self, SEL, NSNotification*)
|
||||
{
|
||||
getOwner (self)->owner.mountedVolumeListChanged();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
MountedVolumeListChangeDetector::MountedVolumeListChangeDetector() { pimpl = new Pimpl (*this); }
|
||||
MountedVolumeListChangeDetector::~MountedVolumeListChangeDetector() {}
|
||||
#endif
|
||||
|
||||
@@ -100,7 +100,6 @@ public:
|
||||
|
||||
virtual ~DeviceChangeDetector() {}
|
||||
|
||||
protected:
|
||||
virtual void systemDeviceChanged() = 0;
|
||||
|
||||
void triggerAsyncDeviceChangeCallback()
|
||||
|
||||
@@ -188,3 +188,30 @@ void MessageManager::doPlatformSpecificShutdown()
|
||||
|
||||
OleUninitialize();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
struct MountedVolumeListChangeDetector::Pimpl : private DeviceChangeDetector
|
||||
{
|
||||
Pimpl (MountedVolumeListChangeDetector& d) : DeviceChangeDetector (L"MountedVolumeList"), owner (d)
|
||||
{
|
||||
File::findFileSystemRoots (lastVolumeList);
|
||||
}
|
||||
|
||||
void systemDeviceChanged() override
|
||||
{
|
||||
Array<File> newList;
|
||||
File::findFileSystemRoots (newList);
|
||||
|
||||
if (lastVolumeList != newList)
|
||||
{
|
||||
lastVolumeList = newList;
|
||||
owner.mountedVolumeListChanged();
|
||||
}
|
||||
}
|
||||
|
||||
MountedVolumeListChangeDetector& owner;
|
||||
Array<File> lastVolumeList;
|
||||
};
|
||||
|
||||
MountedVolumeListChangeDetector::MountedVolumeListChangeDetector() { pimpl = new Pimpl (*this); }
|
||||
MountedVolumeListChangeDetector::~MountedVolumeListChangeDetector() {}
|
||||
|
||||
@@ -332,6 +332,14 @@ void Timer::startTimer (const int interval) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
void Timer::startTimerHz (int timerFrequencyHz) noexcept
|
||||
{
|
||||
if (timerFrequencyHz > 0)
|
||||
startTimer (1000 / timerFrequencyHz);
|
||||
else
|
||||
stopTimer();
|
||||
}
|
||||
|
||||
void Timer::stopTimer() noexcept
|
||||
{
|
||||
const TimerThread::LockType::ScopedLockType sl (TimerThread::lock);
|
||||
|
||||
@@ -91,6 +91,11 @@ public:
|
||||
*/
|
||||
void startTimer (int intervalInMilliseconds) noexcept;
|
||||
|
||||
/** Starts the timer with an interval specified in Hertz.
|
||||
This is effectively the same as calling startTimer (1000 / timerFrequencyHz).
|
||||
*/
|
||||
void startTimerHz (int timerFrequencyHz) noexcept;
|
||||
|
||||
/** Stops the timer.
|
||||
|
||||
No more callbacks will be made after this method returns.
|
||||
@@ -102,14 +107,10 @@ public:
|
||||
void stopTimer() noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Checks if the timer has been started.
|
||||
|
||||
@returns true if the timer is running.
|
||||
*/
|
||||
/** Returns true if the timer is currently running. */
|
||||
bool isTimerRunning() const noexcept { return periodMs > 0; }
|
||||
|
||||
/** Returns the timer's interval.
|
||||
|
||||
@returns the timer's interval in milliseconds if it's running, or 0 if it's not.
|
||||
*/
|
||||
int getTimerInterval() const noexcept { return periodMs; }
|
||||
|
||||
Reference in New Issue
Block a user