mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
parent
a63bec1972
commit
b48a4e7856
12 changed files with 77 additions and 76 deletions
|
|
@ -162,7 +162,7 @@ static BOOL CALLBACK BroadcastEnumWindowProc (HWND hwnd, LPARAM lParam)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void MessageManager::broadcastMessage (const String& value)
|
||||
void MessageManager::broadcastMessage (const String& value) throw()
|
||||
{
|
||||
VoidArray windows;
|
||||
EnumWindows (&BroadcastEnumWindowProc, (LPARAM) &windows);
|
||||
|
|
|
|||
|
|
@ -209,6 +209,7 @@ public:
|
|||
|
||||
addAndMakeVisible (treeView = new TreeView());
|
||||
treeView->setRootItem (rootItem);
|
||||
treeView->setMultiSelectEnabled (true);
|
||||
|
||||
resized();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ juce_ImplementSingleton (ApplicationProperties)
|
|||
|
||||
|
||||
//==============================================================================
|
||||
ApplicationProperties::ApplicationProperties()
|
||||
ApplicationProperties::ApplicationProperties() throw()
|
||||
: userProps (0),
|
||||
commonProps (0),
|
||||
msBeforeSaving (3000),
|
||||
|
|
@ -62,7 +62,7 @@ void ApplicationProperties::setStorageParameters (const String& applicationName,
|
|||
const String& fileNameSuffix,
|
||||
const String& folderName_,
|
||||
const int millisecondsBeforeSaving,
|
||||
const int propertiesFileOptions)
|
||||
const int propertiesFileOptions) throw()
|
||||
{
|
||||
appName = applicationName;
|
||||
fileSuffix = fileNameSuffix;
|
||||
|
|
@ -116,7 +116,7 @@ bool ApplicationProperties::testWriteAccess (const bool testUserSettings,
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
PropertiesFile* ApplicationProperties::getUserSettings()
|
||||
PropertiesFile* ApplicationProperties::getUserSettings() throw()
|
||||
{
|
||||
if (userProps == 0)
|
||||
{
|
||||
|
|
@ -138,7 +138,7 @@ PropertiesFile* ApplicationProperties::getUserSettings()
|
|||
return userProps;
|
||||
}
|
||||
|
||||
PropertiesFile* ApplicationProperties::getCommonSettings()
|
||||
PropertiesFile* ApplicationProperties::getCommonSettings() throw()
|
||||
{
|
||||
if (commonProps == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public:
|
|||
Before using it, you must call setStorageParameters() to give it the info
|
||||
it needs to create the property files.
|
||||
*/
|
||||
ApplicationProperties();
|
||||
ApplicationProperties() throw();
|
||||
|
||||
/** Destructor.
|
||||
*/
|
||||
|
|
@ -87,7 +87,7 @@ public:
|
|||
const String& fileNameSuffix,
|
||||
const String& folderName,
|
||||
const int millisecondsBeforeSaving,
|
||||
const int propertiesFileOptions);
|
||||
const int propertiesFileOptions) throw();
|
||||
|
||||
/** Tests whether the files can be successfully written to, and can show
|
||||
an error message if not.
|
||||
|
|
@ -110,7 +110,7 @@ public:
|
|||
|
||||
@see getCommonSettings
|
||||
*/
|
||||
PropertiesFile* getUserSettings();
|
||||
PropertiesFile* getUserSettings() throw();
|
||||
|
||||
/** Returns the common settings file.
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ public:
|
|||
|
||||
@see getUserSettings
|
||||
*/
|
||||
PropertiesFile* getCommonSettings();
|
||||
PropertiesFile* getCommonSettings() throw();
|
||||
|
||||
//==============================================================================
|
||||
/** Saves both files if they need to be saved.
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static const tchar* const propertyTagName = T("VALUE");
|
|||
//==============================================================================
|
||||
PropertiesFile::PropertiesFile (const File& f,
|
||||
const int millisecondsBeforeSaving,
|
||||
const int options_)
|
||||
const int options_) throw()
|
||||
: PropertySet (ignoreCaseOfKeyNames),
|
||||
file (f),
|
||||
timerInterval (millisecondsBeforeSaving),
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public:
|
|||
*/
|
||||
PropertiesFile (const File& file,
|
||||
const int millisecondsBeforeSaving,
|
||||
const int options);
|
||||
const int options) throw();
|
||||
|
||||
/** Destructor.
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void ChangeListenerList::removeAllChangeListeners() throw()
|
|||
listeners.clear();
|
||||
}
|
||||
|
||||
void ChangeListenerList::sendChangeMessage (void* objectThatHasChanged) throw()
|
||||
void ChangeListenerList::sendChangeMessage (void* const objectThatHasChanged) throw()
|
||||
{
|
||||
const ScopedLock sl (lock);
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ void ChangeListenerList::handleMessage (const Message& message)
|
|||
sendSynchronousChangeMessage (message.pointerParameter);
|
||||
}
|
||||
|
||||
void ChangeListenerList::sendSynchronousChangeMessage (void* objectThatHasChanged)
|
||||
void ChangeListenerList::sendSynchronousChangeMessage (void* const objectThatHasChanged)
|
||||
{
|
||||
const ScopedLock sl (lock);
|
||||
messagePending = false;
|
||||
|
|
|
|||
|
|
@ -201,19 +201,14 @@ bool MessageManager::runDispatchLoop()
|
|||
//==============================================================================
|
||||
void MessageManager::postQuitMessage (const bool useMaximumForce)
|
||||
{
|
||||
if (! quitMessagePosted)
|
||||
{
|
||||
Message* const m = new Message (quitMessageId, (useMaximumForce) ? 1 : 0, 0, 0);
|
||||
m->messageRecipient = 0;
|
||||
|
||||
if (! juce_postMessageToSystemQueue (m))
|
||||
delete m;
|
||||
postMessageToQueue (m);
|
||||
|
||||
quitMessagePosted = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool MessageManager::hasQuitMessageBeenPosted() const
|
||||
bool MessageManager::hasQuitMessageBeenPosted() const throw()
|
||||
{
|
||||
return quitMessagePosted;
|
||||
}
|
||||
|
|
@ -221,13 +216,11 @@ bool MessageManager::hasQuitMessageBeenPosted() const
|
|||
//==============================================================================
|
||||
void MessageManager::deliverBroadcastMessage (const String& value)
|
||||
{
|
||||
if (broadcastListeners == 0)
|
||||
broadcastListeners = new ActionListenerList();
|
||||
|
||||
if (broadcastListeners != 0)
|
||||
broadcastListeners->sendActionMessage (value);
|
||||
}
|
||||
|
||||
void MessageManager::registerBroadcastListener (ActionListener* listener)
|
||||
void MessageManager::registerBroadcastListener (ActionListener* const listener) throw()
|
||||
{
|
||||
if (broadcastListeners == 0)
|
||||
broadcastListeners = new ActionListenerList();
|
||||
|
|
@ -235,24 +228,22 @@ void MessageManager::registerBroadcastListener (ActionListener* listener)
|
|||
broadcastListeners->addActionListener (listener);
|
||||
}
|
||||
|
||||
void MessageManager::deregisterBroadcastListener (ActionListener* listener)
|
||||
void MessageManager::deregisterBroadcastListener (ActionListener* const listener) throw()
|
||||
{
|
||||
if (broadcastListeners == 0)
|
||||
broadcastListeners = new ActionListenerList();
|
||||
|
||||
if (broadcastListeners != 0)
|
||||
broadcastListeners->removeActionListener (listener);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// This gets called occasionally by the timer thread (to save using an extra thread
|
||||
// for it).
|
||||
void MessageManager::inactivityCheckCallback()
|
||||
void MessageManager::inactivityCheckCallback() throw()
|
||||
{
|
||||
if (instance != 0)
|
||||
instance->inactivityCheckCallbackInt();
|
||||
}
|
||||
|
||||
void MessageManager::inactivityCheckCallbackInt()
|
||||
void MessageManager::inactivityCheckCallbackInt() throw()
|
||||
{
|
||||
const unsigned int now = Time::getApproximateMillisecondCounter();
|
||||
|
||||
|
|
@ -277,7 +268,7 @@ void MessageManager::inactivityCheckCallbackInt()
|
|||
}
|
||||
}
|
||||
|
||||
void MessageManager::delayWaitCursor()
|
||||
void MessageManager::delayWaitCursor() throw()
|
||||
{
|
||||
if (instance != 0)
|
||||
{
|
||||
|
|
@ -291,7 +282,7 @@ void MessageManager::delayWaitCursor()
|
|||
}
|
||||
}
|
||||
|
||||
void MessageManager::setTimeBeforeShowingWaitCursor (const int millisecs)
|
||||
void MessageManager::setTimeBeforeShowingWaitCursor (const int millisecs) throw()
|
||||
{
|
||||
// if this is a bit too small you'll get a lot of unwanted hourglass cursors..
|
||||
jassert (millisecs <= 0 || millisecs > 200);
|
||||
|
|
@ -311,22 +302,22 @@ void MessageManager::timerCallback()
|
|||
++messageCounter;
|
||||
}
|
||||
|
||||
int MessageManager::getTimeBeforeShowingWaitCursor() const
|
||||
int MessageManager::getTimeBeforeShowingWaitCursor() const throw()
|
||||
{
|
||||
return timeBeforeWaitCursor;
|
||||
}
|
||||
|
||||
bool MessageManager::isThisTheMessageThread() const
|
||||
bool MessageManager::isThisTheMessageThread() const throw()
|
||||
{
|
||||
return Thread::getCurrentThreadId() == messageThreadId;
|
||||
}
|
||||
|
||||
void MessageManager::setCurrentMessageThread (const int threadId)
|
||||
void MessageManager::setCurrentMessageThread (const int threadId) throw()
|
||||
{
|
||||
messageThreadId = threadId;
|
||||
}
|
||||
|
||||
bool MessageManager::currentThreadHasLockedMessageManager() const
|
||||
bool MessageManager::currentThreadHasLockedMessageManager() const throw()
|
||||
{
|
||||
return Thread::getCurrentThreadId() == currentLockingThreadId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,14 +106,14 @@ public:
|
|||
void* userData);
|
||||
|
||||
/** Returns true if the caller-thread is the message thread. */
|
||||
bool isThisTheMessageThread() const;
|
||||
bool isThisTheMessageThread() const throw();
|
||||
|
||||
/** Called to tell the manager which thread is the one that's running the dispatch loop.
|
||||
|
||||
(Best to ignore this method unless you really know what you're doing..)
|
||||
@see getCurrentMessageThread
|
||||
*/
|
||||
void setCurrentMessageThread (const int threadId);
|
||||
void setCurrentMessageThread (const int threadId) throw();
|
||||
|
||||
/** Returns the ID of the current message thread, as set by setCurrentMessageThread().
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ public:
|
|||
This will be true if the caller is the message thread, because that automatically
|
||||
gains a lock while a message is being dispatched.
|
||||
*/
|
||||
bool currentThreadHasLockedMessageManager() const;
|
||||
bool currentThreadHasLockedMessageManager() const throw();
|
||||
|
||||
//==============================================================================
|
||||
/** Sends a message to all other JUCE applications that are running.
|
||||
|
|
@ -138,7 +138,7 @@ public:
|
|||
method of the broadcast listeners in the other app.
|
||||
@see registerBroadcastListener, ActionListener
|
||||
*/
|
||||
static void broadcastMessage (const String& messageText);
|
||||
static void broadcastMessage (const String& messageText) throw();
|
||||
|
||||
/** Registers a listener to get told about broadcast messages.
|
||||
|
||||
|
|
@ -147,10 +147,10 @@ public:
|
|||
|
||||
@see broadcastMessage
|
||||
*/
|
||||
void registerBroadcastListener (ActionListener* listener);
|
||||
void registerBroadcastListener (ActionListener* listener) throw();
|
||||
|
||||
/** Deregisters a broadcast listener. */
|
||||
void deregisterBroadcastListener (ActionListener* listener);
|
||||
void deregisterBroadcastListener (ActionListener* listener) throw();
|
||||
|
||||
//==============================================================================
|
||||
/** Sets a time-limit for the app to be 'busy' before an hourglass cursor will be shown.
|
||||
|
|
@ -160,24 +160,24 @@ public:
|
|||
Mac the system might still decide to show it after a while).
|
||||
@see MouseCursor::showWaitCursor
|
||||
*/
|
||||
void setTimeBeforeShowingWaitCursor (const int millisecs);
|
||||
void setTimeBeforeShowingWaitCursor (const int millisecs) throw();
|
||||
|
||||
/** Returns the time-out before the 'busy' cursor is shown when the app is busy.
|
||||
|
||||
@see setTimeBeforeShowingWaitCursor, MouseCursor::showWaitCursor
|
||||
*/
|
||||
int getTimeBeforeShowingWaitCursor() const;
|
||||
int getTimeBeforeShowingWaitCursor() const throw();
|
||||
|
||||
/** Tells the message manager that the system isn't locked-up, even if the message
|
||||
loop isn't active.
|
||||
|
||||
Used internally, this is handy when an OS enters its own modal loop.
|
||||
*/
|
||||
static void delayWaitCursor();
|
||||
static void delayWaitCursor() throw();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns true if JUCEApplication::quit() has been called. */
|
||||
bool hasQuitMessageBeenPosted() const;
|
||||
bool hasQuitMessageBeenPosted() const throw();
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
|
|
@ -219,8 +219,8 @@ private:
|
|||
static void doPlatformSpecificShutdown();
|
||||
|
||||
friend class InternalTimerThread;
|
||||
static void inactivityCheckCallback();
|
||||
void inactivityCheckCallbackInt();
|
||||
static void inactivityCheckCallback() throw();
|
||||
void inactivityCheckCallbackInt() throw();
|
||||
|
||||
friend class MessageManagerLock;
|
||||
CriticalSection messageDispatchLock;
|
||||
|
|
|
|||
|
|
@ -58,25 +58,19 @@ public:
|
|||
void mouseDown (const MouseEvent& e)
|
||||
{
|
||||
isDragging = false;
|
||||
needSelectionOnMouseUp = false;
|
||||
|
||||
Rectangle pos;
|
||||
TreeViewItem* const item = findItemAt (e.y, pos);
|
||||
|
||||
if (item != 0 && e.x >= pos.getX())
|
||||
{
|
||||
if (item->isSelected() && owner->isMultiSelectEnabled()
|
||||
&& (e.mods.isCommandDown() || e.mods.isCtrlDown()))
|
||||
{
|
||||
item->setSelected (false, false);
|
||||
}
|
||||
if (! owner->isMultiSelectEnabled())
|
||||
item->setSelected (true, true);
|
||||
else if (item->isSelected())
|
||||
needSelectionOnMouseUp = ! e.mods.isPopupMenu();
|
||||
else
|
||||
{
|
||||
item->setSelected (true,
|
||||
! (owner->isMultiSelectEnabled()
|
||||
&& (e.mods.isCommandDown()
|
||||
|| e.mods.isCtrlDown()
|
||||
|| e.mods.isShiftDown())));
|
||||
}
|
||||
selectBasedOnModifiers (item, e.mods);
|
||||
|
||||
MouseEvent e2 (e);
|
||||
e2.x -= pos.getX();
|
||||
|
|
@ -86,20 +80,26 @@ public:
|
|||
}
|
||||
|
||||
void mouseUp (const MouseEvent& e)
|
||||
{
|
||||
if (e.mouseWasClicked())
|
||||
{
|
||||
Rectangle pos;
|
||||
TreeViewItem* const item = findItemAt (e.y, pos);
|
||||
|
||||
if (item != 0
|
||||
&& e.x >= pos.getX() - owner->getIndentSize()
|
||||
if (item != 0 && e.mouseWasClicked())
|
||||
{
|
||||
if (needSelectionOnMouseUp)
|
||||
{
|
||||
selectBasedOnModifiers (item, e.mods);
|
||||
}
|
||||
else if (e.mouseWasClicked())
|
||||
{
|
||||
if (e.x >= pos.getX() - owner->getIndentSize()
|
||||
&& e.x < pos.getX())
|
||||
{
|
||||
item->setOpen (! item->isOpen());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mouseDoubleClick (const MouseEvent& e)
|
||||
{
|
||||
|
|
@ -258,10 +258,19 @@ private:
|
|||
VoidArray rowComponentItems;
|
||||
Array <int> rowComponentIds;
|
||||
VoidArray rowComponents;
|
||||
bool isDragging;
|
||||
bool isDragging, needSelectionOnMouseUp;
|
||||
|
||||
TreeViewContentComponent (const TreeViewContentComponent&);
|
||||
const TreeViewContentComponent& operator= (const TreeViewContentComponent&);
|
||||
|
||||
static void selectBasedOnModifiers (TreeViewItem* const item, const ModifierKeys& modifiers)
|
||||
{
|
||||
const bool shft = modifiers.isShiftDown();
|
||||
const bool cmd = modifiers.isCommandDown();
|
||||
|
||||
item->setSelected (shft || (! cmd) || (cmd && ! item->isSelected()),
|
||||
! (shft || cmd));
|
||||
}
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ BEGIN_JUCE_NAMESPACE
|
|||
|
||||
|
||||
//==============================================================================
|
||||
PropertySet::PropertySet (const bool ignoreCaseOfKeyNames)
|
||||
PropertySet::PropertySet (const bool ignoreCaseOfKeyNames) throw()
|
||||
: properties (ignoreCaseOfKeyNames),
|
||||
ignoreCaseOfKeys (ignoreCaseOfKeyNames)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
@param ignoreCaseOfKeyNames if true, the names of properties are compared in a
|
||||
case-insensitive way
|
||||
*/
|
||||
PropertySet (const bool ignoreCaseOfKeyNames = false);
|
||||
PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~PropertySet();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue