diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 2558a2077d..5992ef0ea8 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -31267,7 +31267,7 @@ void PluginListComponent::scanFor (AudioPluginFormat* format) aw.addCustomComponent (&pathList); aw.addButton (TRANS("Scan"), 1, KeyPress::returnKey); - aw.addButton (TRANS("Cancel"), 0, KeyPress (KeyPress::escapeKey)); + aw.addButton (TRANS("Cancel"), 0, KeyPress::escapeKey); if (aw.runModalLoop() == 0) return; @@ -31286,7 +31286,7 @@ void PluginListComponent::scanFor (AudioPluginFormat* format) AlertWindow aw (TRANS("Scanning for plugins..."), TRANS("Searching for all possible plugin files..."), AlertWindow::NoIcon); - aw.addButton (TRANS("Cancel"), 0, KeyPress (KeyPress::escapeKey)); + aw.addButton (TRANS("Cancel"), 0, KeyPress::escapeKey); aw.addProgressBarComponent (progress); aw.enterModalState(); @@ -39450,15 +39450,7 @@ public: const int elapsed = now - lastTime; lastTime = now; - int timeUntilFirstTimer = 1000; - - { - const ScopedLock sl (lock); - decrementAllCounters (elapsed); - - if (firstTimer != 0) - timeUntilFirstTimer = firstTimer->countdownMs; - } + const int timeUntilFirstTimer = getTimeUntilFirstTimer (elapsed); if (timeUntilFirstTimer <= 0) { @@ -39680,15 +39672,14 @@ private: t->previous = 0; } - void decrementAllCounters (const int numMillisecs) const + int getTimeUntilFirstTimer (const int numMillisecsElapsed) const { - Timer* t = firstTimer; + const ScopedLock sl (lock); - while (t != 0) - { - t->countdownMs -= numMillisecs; - t = t->next; - } + for (Timer* t = firstTimer; t != 0; t = t->next) + t->countdownMs -= numMillisecsElapsed; + + return firstTimer != 0 ? firstTimer->countdownMs : 1000; } void handleAsyncUpdate() @@ -42959,7 +42950,7 @@ void Desktop::removeGlobalMouseListener (MouseListener* const listener) void Desktop::timerCallback() { - if (lastFakeMouseMove != getRawMousePosition()) + if (lastFakeMouseMove != getMousePosition()) sendMouseMove(); } @@ -42969,7 +42960,7 @@ void Desktop::sendMouseMove() { startTimer (20); - lastFakeMouseMove = getRawMousePosition(); + lastFakeMouseMove = getMousePosition(); Component* const target = findComponentAt (lastFakeMouseMove); @@ -42997,7 +42988,7 @@ void Desktop::resetTimer() else startTimer (100); - lastFakeMouseMove = getRawMousePosition(); + lastFakeMouseMove = getMousePosition(); } extern void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars); @@ -45849,10 +45840,6 @@ public: private: struct SyntaxToken { - String text; - int tokenType; - float width; - SyntaxToken (const String& text_, const int type) throw() : text (text_), tokenType (type), width (-1.0f) { @@ -45862,6 +45849,10 @@ private: { return text != other.text || tokenType != other.tokenType; } + + String text; + int tokenType; + float width; }; Array tokens; @@ -47519,6 +47510,21 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_ComboBox.cpp ***/ BEGIN_JUCE_NAMESPACE +ComboBox::ItemInfo::ItemInfo (const String& name_, int itemId_, bool isEnabled_, bool isHeading_) + : name (name_), itemId (itemId_), isEnabled (isEnabled_), isHeading (isHeading_) +{ +} + +bool ComboBox::ItemInfo::isSeparator() const throw() +{ + return name.isEmpty(); +} + +bool ComboBox::ItemInfo::isRealItem() const throw() +{ + return ! (isHeading || name.isEmpty()); +} + ComboBox::ComboBox (const String& name) : Component (name), lastCurrentId (0), @@ -47589,20 +47595,10 @@ void ComboBox::addItem (const String& newItemText, const int newItemId) if (separatorPending) { separatorPending = false; - - ItemInfo* const item = new ItemInfo(); - item->itemId = 0; - item->isEnabled = false; - item->isHeading = false; - items.add (item); + items.add (new ItemInfo (String::empty, 0, false, false)); } - ItemInfo* const item = new ItemInfo(); - item->name = newItemText; - item->itemId = newItemId; - item->isEnabled = true; - item->isHeading = false; - items.add (item); + items.add (new ItemInfo (newItemText, newItemId, true, false)); } } @@ -47621,20 +47617,10 @@ void ComboBox::addSectionHeading (const String& headingName) if (separatorPending) { separatorPending = false; - - ItemInfo* const item = new ItemInfo(); - item->itemId = 0; - item->isEnabled = false; - item->isHeading = false; - items.add (item); + items.add (new ItemInfo (String::empty, 0, false, false)); } - ItemInfo* const item = new ItemInfo(); - item->name = headingName; - item->itemId = 0; - item->isEnabled = true; - item->isHeading = true; - items.add (item); + items.add (new ItemInfo (headingName, 0, true, true)); } } @@ -47665,16 +47651,6 @@ void ComboBox::clear (const bool dontSendChangeMessage) setSelectedItemIndex (-1, dontSendChangeMessage); } -bool ComboBox::ItemInfo::isSeparator() const throw() -{ - return name.isEmpty(); -} - -bool ComboBox::ItemInfo::isRealItem() const throw() -{ - return ! (isHeading || name.isEmpty()); -} - ComboBox::ItemInfo* ComboBox::getItemForId (const int itemId) const throw() { if (itemId != 0) @@ -47689,9 +47665,7 @@ ComboBox::ItemInfo* ComboBox::getItemForId (const int itemId) const throw() ComboBox::ItemInfo* ComboBox::getItemForIndex (const int index) const throw() { - int n = 0; - - for (int i = 0; i < items.size(); ++i) + for (int n = 0, i = 0; i < items.size(); ++i) { ItemInfo* const item = items.getUnchecked(i); @@ -47718,24 +47692,19 @@ const String ComboBox::getItemText (const int index) const { const ItemInfo* const item = getItemForIndex (index); - if (item != 0) - return item->name; - - return String::empty; + return item != 0 ? item->name : String::empty; } int ComboBox::getItemId (const int index) const throw() { const ItemInfo* const item = getItemForIndex (index); - return (item != 0) ? item->itemId : 0; + return item != 0 ? item->itemId : 0; } int ComboBox::indexOfItemId (const int itemId) const throw() { - int n = 0; - - for (int i = 0; i < items.size(); ++i) + for (int n = 0, i = 0; i < items.size(); ++i) { const ItemInfo* const item = items.getUnchecked(i); @@ -47863,19 +47832,13 @@ const String ComboBox::getTextWhenNoChoicesAvailable() const void ComboBox::paint (Graphics& g) { - getLookAndFeel().drawComboBox (g, - getWidth(), - getHeight(), - isButtonDown, - label->getRight(), - 0, - getWidth() - label->getRight(), - getHeight(), + getLookAndFeel().drawComboBox (g, getWidth(), getHeight(), isButtonDown, + label->getRight(), 0, getWidth() - label->getRight(), getHeight(), *this); if (textWhenNothingSelected.isNotEmpty() - && label->getText().isEmpty() - && ! label->isBeingEdited()) + && label->getText().isEmpty() + && ! label->isBeingEdited()) { g.setColour (findColour (textColourId).withMultipliedAlpha (0.5f)); g.setFont (label->getFont()); @@ -48037,7 +48000,7 @@ void ComboBox::mouseDown (const MouseEvent& e) { beginDragAutoRepeat (300); - isButtonDown = isEnabled(); + isButtonDown = isEnabled() && ! e.mods.isPopupMenu(); if (isButtonDown && (e.eventComponent == this || ! label->isEditable())) showPopup(); @@ -49073,7 +49036,7 @@ void ListBox::selectRowsBasedOnModifierKeys (const int row, } else if ((! mods.isPopupMenu()) || ! isRowSelected (row)) { - selectRowInternal (row, false, true, true); + selectRowInternal (row, false, ! (multipleSelection && isRowSelected (row)), true); } } @@ -58678,7 +58641,10 @@ FileChooserDialogBox::FileChooserDialogBox (const String& name, content->okButton.addButtonListener (this); content->cancelButton.addButtonListener (this); + content->newFolderButton.addButtonListener (this); content->chooserComponent.addListener (this); + + selectionChanged(); } FileChooserDialogBox::~FileChooserDialogBox() @@ -58696,6 +58662,7 @@ bool FileChooserDialogBox::showAt (int x, int y, int w, int h) if (w <= 0) { Component* const previewComp = content->chooserComponent.getPreviewComponent(); + if (previewComp != 0) w = 400 + previewComp->getWidth(); else @@ -58719,28 +58686,16 @@ void FileChooserDialogBox::buttonClicked (Button* button) { if (button == &(content->okButton)) { - if (warnAboutOverwritingExistingFiles - && content->chooserComponent.isSaveMode() - && content->chooserComponent.getSelectedFile(0).exists()) - { - if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon, - TRANS("File already exists"), - TRANS("There's already a file called:") - + "\n\n" + content->chooserComponent.getSelectedFile(0).getFullPathName() - + "\n\n" + TRANS("Are you sure you want to overwrite it?"), - TRANS("overwrite"), - TRANS("cancel"))) - { - return; - } - } - - exitModalState (1); + okButtonPressed(); } else if (button == &(content->cancelButton)) { closeButtonPressed(); } + else if (button == &(content->newFolderButton)) + { + createNewFolder(); + } } void FileChooserDialogBox::closeButtonPressed() @@ -58751,6 +58706,9 @@ void FileChooserDialogBox::closeButtonPressed() void FileChooserDialogBox::selectionChanged() { content->okButton.setEnabled (content->chooserComponent.currentFileIsValid()); + + content->newFolderButton.setVisible (content->chooserComponent.isSaveMode() + && content->chooserComponent.getRoot().isDirectory()); } void FileChooserDialogBox::fileClicked (const File&, const MouseEvent&) @@ -58763,28 +58721,78 @@ void FileChooserDialogBox::fileDoubleClicked (const File&) content->okButton.triggerClick(); } +void FileChooserDialogBox::okButtonPressed() +{ + if ((! (warnAboutOverwritingExistingFiles + && content->chooserComponent.isSaveMode() + && content->chooserComponent.getSelectedFile(0).exists())) + || AlertWindow::showOkCancelBox (AlertWindow::WarningIcon, + TRANS("File already exists"), + TRANS("There's already a file called:") + + "\n\n" + content->chooserComponent.getSelectedFile(0).getFullPathName() + + "\n\n" + TRANS("Are you sure you want to overwrite it?"), + TRANS("overwrite"), + TRANS("cancel"))) + { + exitModalState (1); + } +} + +void FileChooserDialogBox::createNewFolder() +{ + File parent (content->chooserComponent.getRoot()); + + if (parent.isDirectory()) + { + AlertWindow aw (TRANS("New Folder"), + TRANS("Please enter the name for the folder"), + AlertWindow::NoIcon, this); + + aw.addTextEditor ("name", String::empty, String::empty, false); + aw.addButton (TRANS("ok"), 1, KeyPress::returnKey); + aw.addButton (TRANS("cancel"), KeyPress::escapeKey); + + if (aw.runModalLoop() != 0) + { + aw.setVisible (false); + + const String name (File::createLegalFileName (aw.getTextEditorContents ("name"))); + + if (! name.isEmpty()) + { + if (! parent.getChildFile (name).createDirectory()) + { + AlertWindow::showMessageBox (AlertWindow::WarningIcon, + TRANS ("New Folder"), + TRANS ("Couldn't create the folder!")); + } + + content->chooserComponent.refresh(); + } + } + } +} + FileChooserDialogBox::ContentComponent::ContentComponent (const String& name, const String& instructions_, FileBrowserComponent& chooserComponent_) : Component (name), instructions (instructions_), chooserComponent (chooserComponent_), okButton (chooserComponent_.getActionVerb()), - cancelButton (TRANS ("Cancel")) + cancelButton (TRANS ("Cancel")), + newFolderButton (TRANS ("New Folder")) { addAndMakeVisible (&chooserComponent); addAndMakeVisible (&okButton); - okButton.setEnabled (chooserComponent.currentFileIsValid()); - okButton.addShortcut (KeyPress (KeyPress::returnKey, 0, 0)); + okButton.addShortcut (KeyPress::returnKey); addAndMakeVisible (&cancelButton); - cancelButton.addShortcut (KeyPress (KeyPress::escapeKey, 0, 0)); + cancelButton.addShortcut (KeyPress::escapeKey); + + addChildComponent (&newFolderButton); setInterceptsMouseClicks (false, true); } -FileChooserDialogBox::ContentComponent::~ContentComponent() -{ -} - void FileChooserDialogBox::ContentComponent::paint (Graphics& g) { g.setColour (getLookAndFeel().findColour (FileChooserDialogBox::titleTextColourId)); @@ -58793,21 +58801,27 @@ void FileChooserDialogBox::ContentComponent::paint (Graphics& g) void FileChooserDialogBox::ContentComponent::resized() { - getLookAndFeel().createFileChooserHeaderText (getName(), instructions, text, getWidth()); - - const Rectangle bb (text.getBoundingBox (0, text.getNumGlyphs(), false)); - - const int y = roundToInt (bb.getBottom()) + 10; const int buttonHeight = 26; - const int buttonY = getHeight() - buttonHeight - 8; - chooserComponent.setBounds (0, y, getWidth(), buttonY - y - 20); + Rectangle area (getLocalBounds()); - okButton.setBounds (proportionOfWidth (0.25f), buttonY, - proportionOfWidth (0.2f), buttonHeight); + getLookAndFeel().createFileChooserHeaderText (getName(), instructions, text, getWidth()); + const Rectangle bb (text.getBoundingBox (0, text.getNumGlyphs(), false)); + area.removeFromTop (roundToInt (bb.getBottom()) + 10); - cancelButton.setBounds (proportionOfWidth (0.55f), buttonY, - proportionOfWidth (0.2f), buttonHeight); + chooserComponent.setBounds (area.removeFromTop (area.getHeight() - buttonHeight - 20)); + Rectangle buttonArea (area.reduced (16, 10)); + + okButton.changeWidthToFitText (buttonHeight); + okButton.setBounds (buttonArea.removeFromRight (okButton.getWidth() + 16)); + + buttonArea.removeFromRight (16); + + cancelButton.changeWidthToFitText (buttonHeight); + cancelButton.setBounds (buttonArea.removeFromRight (cancelButton.getWidth())); + + newFolderButton.changeWidthToFitText (buttonHeight); + newFolderButton.setBounds (buttonArea.removeFromLeft (newFolderButton.getWidth())); } END_JUCE_NAMESPACE @@ -58891,24 +58905,20 @@ class FileListItemComponent : public Component, public: FileListItemComponent (FileListComponent& owner_, TimeSliceThread& thread_) - : owner (owner_), thread (thread_), - highlighted (false), index (0), icon (0) + : owner (owner_), thread (thread_), index (0), highlighted (false) { } ~FileListItemComponent() { thread.removeTimeSliceClient (this); - - clearIcon(); } void paint (Graphics& g) { getLookAndFeel().drawFileBrowserRow (g, getWidth(), getHeight(), file.getFileName(), - &icon, - fileSize, modTime, + &icon, fileSize, modTime, isDirectory, highlighted, index, owner); } @@ -58931,8 +58941,7 @@ public: { thread.removeTimeSliceClient (this); - if (highlighted_ != highlighted - || index_ != index) + if (highlighted_ != highlighted || index_ != index) { index = index_; highlighted = highlighted_; @@ -58940,8 +58949,7 @@ public: } File newFile; - String newFileSize; - String newModTime; + String newFileSize, newModTime; if (fileInfo != 0) { @@ -58957,11 +58965,10 @@ public: file = newFile; fileSize = newFileSize; modTime = newModTime; - + icon = Image::null; isDirectory = fileInfo != 0 && fileInfo->isDirectory; - repaint(); - clearIcon(); + repaint(); } if (file != File::nonexistent && icon.isNull() && ! isDirectory) @@ -58988,18 +58995,11 @@ private: FileListComponent& owner; TimeSliceThread& thread; - bool highlighted; - int index; File file; - String fileSize; - String modTime; + String fileSize, modTime; Image icon; - bool isDirectory; - - void clearIcon() - { - icon = Image::null; - } + int index; + bool highlighted, isDirectory; void updateIcon (const bool onlyUpdateIfCached) { @@ -68969,6 +68969,7 @@ public: contentHeight (0), childYOffset (0), menuCreationTime (Time::getMillisecondCounter()), + lastMouseMoveTime (0), timeEnteredCurrentChildComp (0), scrollAcceleration (1.0) { @@ -70380,7 +70381,14 @@ void ComponentDragger::dragComponent (Component* const componentToDrag, const Mo if (componentToDrag != 0) { Rectangle bounds (componentToDrag->getBounds()); - bounds += e.getEventRelativeTo (componentToDrag).getPosition() - mouseDownWithinTarget; + + // If the component is a window, multiple mouse events can get queued while it's in the same position, + // so their coordinates become wrong after the first one moves the window, so in that case, we'll use + // the current mouse position instead of the one that the event contains... + if (componentToDrag->isOnDesktop()) + bounds += componentToDrag->getMouseXYRelative() - mouseDownWithinTarget; + else + bounds += e.getEventRelativeTo (componentToDrag).getPosition() - mouseDownWithinTarget; if (constrainer != 0) constrainer->setBoundsForComponent (componentToDrag, bounds, false, false, false, false); @@ -71130,10 +71138,6 @@ public: { } - ~MouseInputSourceInternal() - { - } - bool isDragging() const throw() { return buttonState.isAnyMouseButtonDown(); @@ -71174,8 +71178,12 @@ public: return 0; } - const Point getScreenPosition() const throw() + const Point getScreenPosition() { + // This must only be called with the message manager locked! + jassert (MessageManager::getInstance()->currentThreadHasLockedMessageManager()); + + setScreenPos (MouseInputSource::getCurrentMousePosition(), Time::currentTimeMillis(), false); return lastScreenPos + unboundedMouseOffset; } @@ -71504,8 +71512,8 @@ public: showMouseCursor (mc, forcedUpdate); } - int index; - bool isMouseDevice; + const int index; + const bool isMouseDevice; Point lastScreenPos; ModifierKeys buttonState; @@ -71531,7 +71539,7 @@ private: Component* component; ModifierKeys buttons; - bool canBePartOfMultipleClickWith (const RecentMouseDown& other, int maxTimeBetween) const + bool canBePartOfMultipleClickWith (const RecentMouseDown& other, const int maxTimeBetween) const { return time - other.time < maxTimeBetween && abs (position.getX() - other.position.getX()) < 8 @@ -243686,7 +243694,7 @@ void Desktop::createMouseInputSources() mouseSources.add (new MouseInputSource (0, true)); } -const Point Desktop::getRawMousePosition() +const Point MouseInputSource::getCurrentMousePosition() { POINT mousePos; GetCursorPos (&mousePos); @@ -254075,12 +254083,12 @@ public: Pimpl (const String& name, const int timeOutMillisecs) : handle (0), refCount (1) { -#if JUCE_MAC + #if JUCE_MAC // (don't use getSpecialLocation() to avoid the temp folder being different for each app) const File temp (File ("~/Library/Caches/Juce").getChildFile (name)); -#else + #else const File temp (File::getSpecialLocation (File::tempDirectory).getChildFile (name)); -#endif + #endif temp.create(); handle = open (temp.getFullPathName().toUTF8(), O_RDWR); @@ -259431,7 +259439,7 @@ bool Desktop::canUseSemiTransparentWindows() throw() && (matchedDepth == desiredDepth); } -const Point Desktop::getRawMousePosition() +const Point MouseInputSource::getCurrentMousePosition() { Window root, child; int x, y, winx, winy; @@ -260228,15 +260236,13 @@ public: return false; } - /* -#if JUCE_DEBUG + #if 0 // enable this to dump the config of the devices that get opened snd_output_t* out; snd_output_stdio_attach (&out, stderr, 0); snd_pcm_hw_params_dump (hwParams, out); snd_pcm_sw_params_dump (swParams, out); -#endif - */ + #endif numChannelsRunning = numChannels; @@ -263876,12 +263882,12 @@ public: Pimpl (const String& name, const int timeOutMillisecs) : handle (0), refCount (1) { -#if JUCE_MAC + #if JUCE_MAC // (don't use getSpecialLocation() to avoid the temp folder being different for each app) const File temp (File ("~/Library/Caches/Juce").getChildFile (name)); -#else + #else const File temp (File::getSpecialLocation (File::tempDirectory).getChildFile (name)); -#endif + #endif temp.create(); handle = open (temp.getFullPathName().toUTF8(), O_RDWR); @@ -264118,7 +264124,7 @@ void File::findFileSystemRoots (Array& destArray) destArray.add (File ("/")); } -namespace +namespace FileHelpers { bool isFileOnDriveType (const File& f, const char* const* types) { @@ -264136,7 +264142,7 @@ namespace return false; } - bool juce_isHiddenFile (const String& path) + bool isHiddenFile (const String& path) { #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 const ScopedAutoReleasePool pool; @@ -264160,34 +264166,55 @@ namespace #endif } -#if JUCE_IOS + #if JUCE_IOS const String getIOSSystemLocation (NSSearchPathDirectory type) { return nsStringToJuce ([NSSearchPathForDirectoriesInDomains (type, NSUserDomainMask, YES) objectAtIndex: 0]); } -#endif + #endif + + bool launchExecutable (const String& pathAndArguments) + { + const char* const argv[4] = { "/bin/sh", "-c", pathAndArguments.toUTF8(), 0 }; + + const int cpid = fork(); + + if (cpid == 0) + { + // Child process + if (execve (argv[0], (char**) argv, 0) < 0) + exit (0); + } + else + { + if (cpid < 0) + return false; + } + + return true; + } } bool File::isOnCDRomDrive() const { const char* const cdTypes[] = { "cd9660", "cdfs", "cddafs", "udf", 0 }; - return isFileOnDriveType (*this, cdTypes); + return FileHelpers::isFileOnDriveType (*this, cdTypes); } bool File::isOnHardDisk() const { const char* const nonHDTypes[] = { "nfs", "smbfs", "ramfs", 0 }; - return ! (isOnCDRomDrive() || isFileOnDriveType (*this, nonHDTypes)); + return ! (isOnCDRomDrive() || FileHelpers::isFileOnDriveType (*this, nonHDTypes)); } bool File::isOnRemovableDrive() const { -#if JUCE_IOS + #if JUCE_IOS return false; // xxx is this possible? -#else + #else const ScopedAutoReleasePool pool; BOOL removable = false; @@ -264200,12 +264227,12 @@ bool File::isOnRemovableDrive() const type: nil]; return removable; -#endif + #endif } bool File::isHidden() const { - return juce_isHiddenFile (getFullPathName()); + return FileHelpers::isHiddenFile (getFullPathName()); } const char* juce_Argv0 = 0; // referenced from juce_Application.cpp @@ -264220,7 +264247,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) { case userHomeDirectory: resultPath = nsStringToJuce (NSHomeDirectory()); break; -#if JUCE_IOS + #if JUCE_IOS case userDocumentsDirectory: resultPath = getIOSSystemLocation (NSDocumentDirectory); break; case userDesktopDirectory: resultPath = getIOSSystemLocation (NSDesktopDirectory); break; @@ -264232,7 +264259,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) return tmp.getFullPathName(); } -#else + #else case userDocumentsDirectory: resultPath = "~/Documents"; break; case userDesktopDirectory: resultPath = "~/Desktop"; break; @@ -264242,7 +264269,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) tmp.createDirectory(); return tmp.getFullPathName(); } -#endif + #endif case userMusicDirectory: resultPath = "~/Music"; break; case userMoviesDirectory: resultPath = "~/Movies"; break; case userApplicationDataDirectory: resultPath = "~/Library"; break; @@ -264317,13 +264344,13 @@ const String File::getVersion() const const File File::getLinkedTarget() const { -#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) + #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil]; -#else + #else // (the cast here avoids a deprecation warning) NSString* dest = [((id) [NSFileManager defaultManager]) pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())]; -#endif + #endif if (dest != nil) return File (nsStringToJuce (dest)); @@ -264336,9 +264363,9 @@ bool File::moveToTrash() const if (! exists()) return true; -#if JUCE_IOS + #if JUCE_IOS return deleteFile(); //xxx is there a trashcan on the iPhone? -#else + #else const ScopedAutoReleasePool pool; NSString* p = juceStringToNS (getFullPathName()); @@ -264349,7 +264376,7 @@ bool File::moveToTrash() const destination: @"" files: [NSArray arrayWithObject: [p lastPathComponent]] tag: nil ]; -#endif + #endif } class DirectoryIterator::NativeIterator::Pimpl @@ -264404,7 +264431,7 @@ public: } if (isHidden != 0) - *isHidden = juce_isHiddenFile (path); + *isHidden = FileHelpers::isHiddenFile (path); if (isReadOnly != 0) *isReadOnly = access (path.toUTF8(), W_OK) != 0; @@ -264437,32 +264464,11 @@ bool DirectoryIterator::NativeIterator::next (String& filenameFound, return pimpl->next (filenameFound, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly); } -bool juce_launchExecutable (const String& pathAndArguments) -{ - const char* const argv[4] = { "/bin/sh", "-c", pathAndArguments.toUTF8(), 0 }; - - const int cpid = fork(); - - if (cpid == 0) - { - // Child process - if (execve (argv[0], (char**) argv, 0) < 0) - exit (0); - } - else - { - if (cpid < 0) - return false; - } - - return true; -} - bool PlatformUtilities::openDocument (const String& fileName, const String& parameters) { -#if JUCE_IOS + #if JUCE_IOS return [[UIApplication sharedApplication] openURL: [NSURL fileURLWithPath: juceStringToNS (fileName)]]; -#else + #else const ScopedAutoReleasePool pool; if (parameters.isEmpty()) @@ -264490,21 +264496,21 @@ bool PlatformUtilities::openDocument (const String& fileName, const String& para } else if (File (fileName).exists()) { - ok = juce_launchExecutable ("\"" + fileName + "\" " + parameters); + ok = FileHelpers::launchExecutable ("\"" + fileName + "\" " + parameters); } return ok; -#endif + #endif } void File::revealToUser() const { -#if ! JUCE_IOS + #if ! JUCE_IOS if (exists()) [[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: @""]; else if (getParentDirectory().exists()) getParentDirectory().revealToUser(); -#endif + #endif } #if ! JUCE_IOS @@ -264529,24 +264535,24 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename) { const ScopedAutoReleasePool pool; -#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) + #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; -#else + #else // (the cast here avoids a deprecation warning) NSDictionary* fileDict = [((id) [NSFileManager defaultManager]) fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; -#endif + #endif return [fileDict fileHFSTypeCode]; } bool PlatformUtilities::isBundle (const String& filename) { -#if JUCE_IOS + #if JUCE_IOS return false; // xxx can't find a sensible way to do this without trying to open the bundle.. -#else + #else const ScopedAutoReleasePool pool; return [[NSWorkspace sharedWorkspace] isFilePackageAtPath: juceStringToNS (filename)]; -#endif + #endif } #endif @@ -264820,7 +264826,7 @@ bool Desktop::canUseSemiTransparentWindows() throw() return true; } -const Point Desktop::getRawMousePosition() +const Point MouseInputSource::getCurrentMousePosition() { const ScopedAutoReleasePool pool; const NSPoint p ([NSEvent mouseLocation]); @@ -267224,7 +267230,7 @@ bool Desktop::canUseSemiTransparentWindows() throw() return true; } -const Point Desktop::getRawMousePosition() +const Point MouseInputSource::getCurrentMousePosition() { return juce_lastMousePos; } @@ -269165,7 +269171,7 @@ AudioIODeviceType* juce_createAudioIODeviceType_iPhoneAudio() namespace CoreMidiHelpers { - static bool logError (const OSStatus err, const int lineNum) + bool logError (const OSStatus err, const int lineNum) { if (err == noErr) return true; @@ -269178,7 +269184,7 @@ namespace CoreMidiHelpers #undef CHECK_ERROR #define CHECK_ERROR(a) CoreMidiHelpers::logError (a, __LINE__) - static const String getEndpointName (MIDIEndpointRef endpoint, bool isExternal) + const String getEndpointName (MIDIEndpointRef endpoint, bool isExternal) { String result; CFStringRef str = 0; @@ -269240,7 +269246,7 @@ namespace CoreMidiHelpers return result; } - static const String getConnectedEndpointName (MIDIEndpointRef endpoint) + const String getConnectedEndpointName (MIDIEndpointRef endpoint) { String result; @@ -269309,7 +269315,7 @@ namespace CoreMidiHelpers return getEndpointName (endpoint, false); } - static MIDIClientRef getGlobalMidiClient() + MIDIClientRef getGlobalMidiClient() { static MIDIClientRef globalMidiClient = 0; @@ -269358,8 +269364,8 @@ namespace CoreMidiHelpers }; class MidiPortAndCallback; - static CriticalSection callbackLock; - static Array activeCallbacks; + CriticalSection callbackLock; + Array activeCallbacks; class MidiPortAndCallback { @@ -269410,7 +269416,7 @@ namespace CoreMidiHelpers MidiDataConcatenator concatenator; }; - static void midiInputProc (const MIDIPacketList* pktlist, void* readProcRefCon, void* /*srcConnRefCon*/) + void midiInputProc (const MIDIPacketList* pktlist, void* readProcRefCon, void* /*srcConnRefCon*/) { static_cast (readProcRefCon)->handlePackets (pktlist); } @@ -277675,7 +277681,7 @@ AudioIODeviceType* juce_createAudioIODeviceType_CoreAudio() namespace CoreMidiHelpers { - static bool logError (const OSStatus err, const int lineNum) + bool logError (const OSStatus err, const int lineNum) { if (err == noErr) return true; @@ -277688,7 +277694,7 @@ namespace CoreMidiHelpers #undef CHECK_ERROR #define CHECK_ERROR(a) CoreMidiHelpers::logError (a, __LINE__) - static const String getEndpointName (MIDIEndpointRef endpoint, bool isExternal) + const String getEndpointName (MIDIEndpointRef endpoint, bool isExternal) { String result; CFStringRef str = 0; @@ -277750,7 +277756,7 @@ namespace CoreMidiHelpers return result; } - static const String getConnectedEndpointName (MIDIEndpointRef endpoint) + const String getConnectedEndpointName (MIDIEndpointRef endpoint) { String result; @@ -277819,7 +277825,7 @@ namespace CoreMidiHelpers return getEndpointName (endpoint, false); } - static MIDIClientRef getGlobalMidiClient() + MIDIClientRef getGlobalMidiClient() { static MIDIClientRef globalMidiClient = 0; @@ -277868,8 +277874,8 @@ namespace CoreMidiHelpers }; class MidiPortAndCallback; - static CriticalSection callbackLock; - static Array activeCallbacks; + CriticalSection callbackLock; + Array activeCallbacks; class MidiPortAndCallback { @@ -277920,7 +277926,7 @@ namespace CoreMidiHelpers MidiDataConcatenator concatenator; }; - static void midiInputProc (const MIDIPacketList* pktlist, void* readProcRefCon, void* /*srcConnRefCon*/) + void midiInputProc (const MIDIPacketList* pktlist, void* readProcRefCon, void* /*srcConnRefCon*/) { static_cast (readProcRefCon)->handlePackets (pktlist); } diff --git a/juce_amalgamated.h b/juce_amalgamated.h index ca85fd4d29..0b9bc76e96 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -64,7 +64,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 100 +#define JUCE_BUILDNUMBER 102 /** Current Juce version number. @@ -29637,8 +29637,6 @@ private: ComponentAnimator animator; - static const Point getRawMousePosition(); - void timerCallback(); void resetTimer(); @@ -38716,12 +38714,13 @@ private: struct ItemInfo { + ItemInfo (const String& name, int itemId, bool isEnabled, bool isHeading); + bool isSeparator() const throw(); + bool isRealItem() const throw(); + String name; int itemId; bool isEnabled : 1, isHeading : 1; - - bool isSeparator() const throw(); - bool isRealItem() const throw(); }; class Callback; @@ -51981,7 +51980,6 @@ private: { public: ContentComponent (const String& name, const String& instructions, FileBrowserComponent& chooserComponent); - ~ContentComponent(); void paint (Graphics& g); void resized(); @@ -51990,12 +51988,15 @@ private: GlyphArrangement text; FileBrowserComponent& chooserComponent; - TextButton okButton, cancelButton; + TextButton okButton, cancelButton, newFolderButton; }; ContentComponent* content; const bool warnAboutOverwritingExistingFiles; + void okButtonPressed(); + void createNewFolder(); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileChooserDialogBox); }; @@ -56718,6 +56719,8 @@ private: friend class MouseInputSourceInternal; ScopedPointer pimpl; + static const Point getCurrentMousePosition(); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MouseInputSource); }; diff --git a/src/audio/plugins/juce_PluginListComponent.cpp b/src/audio/plugins/juce_PluginListComponent.cpp index 7671d12bd4..014b1172df 100644 --- a/src/audio/plugins/juce_PluginListComponent.cpp +++ b/src/audio/plugins/juce_PluginListComponent.cpp @@ -243,7 +243,7 @@ void PluginListComponent::scanFor (AudioPluginFormat* format) aw.addCustomComponent (&pathList); aw.addButton (TRANS("Scan"), 1, KeyPress::returnKey); - aw.addButton (TRANS("Cancel"), 0, KeyPress (KeyPress::escapeKey)); + aw.addButton (TRANS("Cancel"), 0, KeyPress::escapeKey); if (aw.runModalLoop() == 0) return; @@ -262,7 +262,7 @@ void PluginListComponent::scanFor (AudioPluginFormat* format) AlertWindow aw (TRANS("Scanning for plugins..."), TRANS("Searching for all possible plugin files..."), AlertWindow::NoIcon); - aw.addButton (TRANS("Cancel"), 0, KeyPress (KeyPress::escapeKey)); + aw.addButton (TRANS("Cancel"), 0, KeyPress::escapeKey); aw.addProgressBarComponent (progress); aw.enterModalState(); diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index 34a5768f6b..f56f35f88c 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 100 +#define JUCE_BUILDNUMBER 102 /** Current Juce version number. diff --git a/src/events/juce_Timer.cpp b/src/events/juce_Timer.cpp index 7d6081880c..72fec44435 100644 --- a/src/events/juce_Timer.cpp +++ b/src/events/juce_Timer.cpp @@ -78,15 +78,7 @@ public: const int elapsed = now - lastTime; lastTime = now; - int timeUntilFirstTimer = 1000; - - { - const ScopedLock sl (lock); - decrementAllCounters (elapsed); - - if (firstTimer != 0) - timeUntilFirstTimer = firstTimer->countdownMs; - } + const int timeUntilFirstTimer = getTimeUntilFirstTimer (elapsed); if (timeUntilFirstTimer <= 0) { @@ -309,15 +301,14 @@ private: t->previous = 0; } - void decrementAllCounters (const int numMillisecs) const + int getTimeUntilFirstTimer (const int numMillisecsElapsed) const { - Timer* t = firstTimer; + const ScopedLock sl (lock); - while (t != 0) - { - t->countdownMs -= numMillisecs; - t = t->next; - } + for (Timer* t = firstTimer; t != 0; t = t->next) + t->countdownMs -= numMillisecsElapsed; + + return firstTimer != 0 ? firstTimer->countdownMs : 1000; } void handleAsyncUpdate() diff --git a/src/gui/components/code_editor/juce_CodeEditorComponent.cpp b/src/gui/components/code_editor/juce_CodeEditorComponent.cpp index 8296f43690..233b41c88a 100644 --- a/src/gui/components/code_editor/juce_CodeEditorComponent.cpp +++ b/src/gui/components/code_editor/juce_CodeEditorComponent.cpp @@ -182,10 +182,6 @@ public: private: struct SyntaxToken { - String text; - int tokenType; - float width; - SyntaxToken (const String& text_, const int type) throw() : text (text_), tokenType (type), width (-1.0f) { @@ -195,6 +191,10 @@ private: { return text != other.text || tokenType != other.tokenType; } + + String text; + int tokenType; + float width; }; Array tokens; diff --git a/src/gui/components/controls/juce_ComboBox.cpp b/src/gui/components/controls/juce_ComboBox.cpp index fe68491d67..64a36154bb 100644 --- a/src/gui/components/controls/juce_ComboBox.cpp +++ b/src/gui/components/controls/juce_ComboBox.cpp @@ -33,6 +33,22 @@ BEGIN_JUCE_NAMESPACE #include "../../../text/juce_LocalisedStrings.h" +//============================================================================== +ComboBox::ItemInfo::ItemInfo (const String& name_, int itemId_, bool isEnabled_, bool isHeading_) + : name (name_), itemId (itemId_), isEnabled (isEnabled_), isHeading (isHeading_) +{ +} + +bool ComboBox::ItemInfo::isSeparator() const throw() +{ + return name.isEmpty(); +} + +bool ComboBox::ItemInfo::isRealItem() const throw() +{ + return ! (isHeading || name.isEmpty()); +} + //============================================================================== ComboBox::ComboBox (const String& name) : Component (name), @@ -106,20 +122,10 @@ void ComboBox::addItem (const String& newItemText, const int newItemId) if (separatorPending) { separatorPending = false; - - ItemInfo* const item = new ItemInfo(); - item->itemId = 0; - item->isEnabled = false; - item->isHeading = false; - items.add (item); + items.add (new ItemInfo (String::empty, 0, false, false)); } - ItemInfo* const item = new ItemInfo(); - item->name = newItemText; - item->itemId = newItemId; - item->isEnabled = true; - item->isHeading = false; - items.add (item); + items.add (new ItemInfo (newItemText, newItemId, true, false)); } } @@ -138,20 +144,10 @@ void ComboBox::addSectionHeading (const String& headingName) if (separatorPending) { separatorPending = false; - - ItemInfo* const item = new ItemInfo(); - item->itemId = 0; - item->isEnabled = false; - item->isHeading = false; - items.add (item); + items.add (new ItemInfo (String::empty, 0, false, false)); } - ItemInfo* const item = new ItemInfo(); - item->name = headingName; - item->itemId = 0; - item->isEnabled = true; - item->isHeading = true; - items.add (item); + items.add (new ItemInfo (headingName, 0, true, true)); } } @@ -182,17 +178,6 @@ void ComboBox::clear (const bool dontSendChangeMessage) setSelectedItemIndex (-1, dontSendChangeMessage); } -//============================================================================== -bool ComboBox::ItemInfo::isSeparator() const throw() -{ - return name.isEmpty(); -} - -bool ComboBox::ItemInfo::isRealItem() const throw() -{ - return ! (isHeading || name.isEmpty()); -} - //============================================================================== ComboBox::ItemInfo* ComboBox::getItemForId (const int itemId) const throw() { @@ -208,9 +193,7 @@ ComboBox::ItemInfo* ComboBox::getItemForId (const int itemId) const throw() ComboBox::ItemInfo* ComboBox::getItemForIndex (const int index) const throw() { - int n = 0; - - for (int i = 0; i < items.size(); ++i) + for (int n = 0, i = 0; i < items.size(); ++i) { ItemInfo* const item = items.getUnchecked(i); @@ -237,24 +220,19 @@ const String ComboBox::getItemText (const int index) const { const ItemInfo* const item = getItemForIndex (index); - if (item != 0) - return item->name; - - return String::empty; + return item != 0 ? item->name : String::empty; } int ComboBox::getItemId (const int index) const throw() { const ItemInfo* const item = getItemForIndex (index); - return (item != 0) ? item->itemId : 0; + return item != 0 ? item->itemId : 0; } int ComboBox::indexOfItemId (const int itemId) const throw() { - int n = 0; - - for (int i = 0; i < items.size(); ++i) + for (int n = 0, i = 0; i < items.size(); ++i) { const ItemInfo* const item = items.getUnchecked(i); @@ -386,19 +364,13 @@ const String ComboBox::getTextWhenNoChoicesAvailable() const //============================================================================== void ComboBox::paint (Graphics& g) { - getLookAndFeel().drawComboBox (g, - getWidth(), - getHeight(), - isButtonDown, - label->getRight(), - 0, - getWidth() - label->getRight(), - getHeight(), + getLookAndFeel().drawComboBox (g, getWidth(), getHeight(), isButtonDown, + label->getRight(), 0, getWidth() - label->getRight(), getHeight(), *this); if (textWhenNothingSelected.isNotEmpty() - && label->getText().isEmpty() - && ! label->isBeingEdited()) + && label->getText().isEmpty() + && ! label->isBeingEdited()) { g.setColour (findColour (textColourId).withMultipliedAlpha (0.5f)); g.setFont (label->getFont()); @@ -566,7 +538,7 @@ void ComboBox::mouseDown (const MouseEvent& e) { beginDragAutoRepeat (300); - isButtonDown = isEnabled(); + isButtonDown = isEnabled() && ! e.mods.isPopupMenu(); if (isButtonDown && (e.eventComponent == this || ! label->isEditable())) showPopup(); diff --git a/src/gui/components/controls/juce_ComboBox.h b/src/gui/components/controls/juce_ComboBox.h index 1d1a963b35..9cead1222c 100644 --- a/src/gui/components/controls/juce_ComboBox.h +++ b/src/gui/components/controls/juce_ComboBox.h @@ -375,12 +375,13 @@ private: //============================================================================== struct ItemInfo { + ItemInfo (const String& name, int itemId, bool isEnabled, bool isHeading); + bool isSeparator() const throw(); + bool isRealItem() const throw(); + String name; int itemId; bool isEnabled : 1, isHeading : 1; - - bool isSeparator() const throw(); - bool isRealItem() const throw(); }; class Callback; diff --git a/src/gui/components/controls/juce_ListBox.cpp b/src/gui/components/controls/juce_ListBox.cpp index 87344e12fe..296296033d 100644 --- a/src/gui/components/controls/juce_ListBox.cpp +++ b/src/gui/components/controls/juce_ListBox.cpp @@ -583,7 +583,7 @@ void ListBox::selectRowsBasedOnModifierKeys (const int row, } else if ((! mods.isPopupMenu()) || ! isRowSelected (row)) { - selectRowInternal (row, false, true, true); + selectRowInternal (row, false, ! (multipleSelection && isRowSelected (row)), true); } } diff --git a/src/gui/components/filebrowser/juce_FileChooserDialogBox.cpp b/src/gui/components/filebrowser/juce_FileChooserDialogBox.cpp index 3d26c8e4bb..c7b019cc7c 100644 --- a/src/gui/components/filebrowser/juce_FileChooserDialogBox.cpp +++ b/src/gui/components/filebrowser/juce_FileChooserDialogBox.cpp @@ -49,7 +49,10 @@ FileChooserDialogBox::FileChooserDialogBox (const String& name, content->okButton.addButtonListener (this); content->cancelButton.addButtonListener (this); + content->newFolderButton.addButtonListener (this); content->chooserComponent.addListener (this); + + selectionChanged(); } FileChooserDialogBox::~FileChooserDialogBox() @@ -68,6 +71,7 @@ bool FileChooserDialogBox::showAt (int x, int y, int w, int h) if (w <= 0) { Component* const previewComp = content->chooserComponent.getPreviewComponent(); + if (previewComp != 0) w = 400 + previewComp->getWidth(); else @@ -92,28 +96,16 @@ void FileChooserDialogBox::buttonClicked (Button* button) { if (button == &(content->okButton)) { - if (warnAboutOverwritingExistingFiles - && content->chooserComponent.isSaveMode() - && content->chooserComponent.getSelectedFile(0).exists()) - { - if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon, - TRANS("File already exists"), - TRANS("There's already a file called:") - + "\n\n" + content->chooserComponent.getSelectedFile(0).getFullPathName() - + "\n\n" + TRANS("Are you sure you want to overwrite it?"), - TRANS("overwrite"), - TRANS("cancel"))) - { - return; - } - } - - exitModalState (1); + okButtonPressed(); } else if (button == &(content->cancelButton)) { closeButtonPressed(); } + else if (button == &(content->newFolderButton)) + { + createNewFolder(); + } } void FileChooserDialogBox::closeButtonPressed() @@ -124,6 +116,9 @@ void FileChooserDialogBox::closeButtonPressed() void FileChooserDialogBox::selectionChanged() { content->okButton.setEnabled (content->chooserComponent.currentFileIsValid()); + + content->newFolderButton.setVisible (content->chooserComponent.isSaveMode() + && content->chooserComponent.getRoot().isDirectory()); } void FileChooserDialogBox::fileClicked (const File&, const MouseEvent&) @@ -136,29 +131,79 @@ void FileChooserDialogBox::fileDoubleClicked (const File&) content->okButton.triggerClick(); } +void FileChooserDialogBox::okButtonPressed() +{ + if ((! (warnAboutOverwritingExistingFiles + && content->chooserComponent.isSaveMode() + && content->chooserComponent.getSelectedFile(0).exists())) + || AlertWindow::showOkCancelBox (AlertWindow::WarningIcon, + TRANS("File already exists"), + TRANS("There's already a file called:") + + "\n\n" + content->chooserComponent.getSelectedFile(0).getFullPathName() + + "\n\n" + TRANS("Are you sure you want to overwrite it?"), + TRANS("overwrite"), + TRANS("cancel"))) + { + exitModalState (1); + } +} + +void FileChooserDialogBox::createNewFolder() +{ + File parent (content->chooserComponent.getRoot()); + + if (parent.isDirectory()) + { + AlertWindow aw (TRANS("New Folder"), + TRANS("Please enter the name for the folder"), + AlertWindow::NoIcon, this); + + aw.addTextEditor ("name", String::empty, String::empty, false); + aw.addButton (TRANS("ok"), 1, KeyPress::returnKey); + aw.addButton (TRANS("cancel"), KeyPress::escapeKey); + + if (aw.runModalLoop() != 0) + { + aw.setVisible (false); + + const String name (File::createLegalFileName (aw.getTextEditorContents ("name"))); + + if (! name.isEmpty()) + { + if (! parent.getChildFile (name).createDirectory()) + { + AlertWindow::showMessageBox (AlertWindow::WarningIcon, + TRANS ("New Folder"), + TRANS ("Couldn't create the folder!")); + } + + content->chooserComponent.refresh(); + } + } + } +} + //============================================================================== FileChooserDialogBox::ContentComponent::ContentComponent (const String& name, const String& instructions_, FileBrowserComponent& chooserComponent_) : Component (name), instructions (instructions_), chooserComponent (chooserComponent_), okButton (chooserComponent_.getActionVerb()), - cancelButton (TRANS ("Cancel")) + cancelButton (TRANS ("Cancel")), + newFolderButton (TRANS ("New Folder")) { addAndMakeVisible (&chooserComponent); addAndMakeVisible (&okButton); - okButton.setEnabled (chooserComponent.currentFileIsValid()); - okButton.addShortcut (KeyPress (KeyPress::returnKey, 0, 0)); + okButton.addShortcut (KeyPress::returnKey); addAndMakeVisible (&cancelButton); - cancelButton.addShortcut (KeyPress (KeyPress::escapeKey, 0, 0)); + cancelButton.addShortcut (KeyPress::escapeKey); + + addChildComponent (&newFolderButton); setInterceptsMouseClicks (false, true); } -FileChooserDialogBox::ContentComponent::~ContentComponent() -{ -} - void FileChooserDialogBox::ContentComponent::paint (Graphics& g) { g.setColour (getLookAndFeel().findColour (FileChooserDialogBox::titleTextColourId)); @@ -167,23 +212,28 @@ void FileChooserDialogBox::ContentComponent::paint (Graphics& g) void FileChooserDialogBox::ContentComponent::resized() { - getLookAndFeel().createFileChooserHeaderText (getName(), instructions, text, getWidth()); - - const Rectangle bb (text.getBoundingBox (0, text.getNumGlyphs(), false)); - - const int y = roundToInt (bb.getBottom()) + 10; const int buttonHeight = 26; - const int buttonY = getHeight() - buttonHeight - 8; - chooserComponent.setBounds (0, y, getWidth(), buttonY - y - 20); + Rectangle area (getLocalBounds()); - okButton.setBounds (proportionOfWidth (0.25f), buttonY, - proportionOfWidth (0.2f), buttonHeight); + getLookAndFeel().createFileChooserHeaderText (getName(), instructions, text, getWidth()); + const Rectangle bb (text.getBoundingBox (0, text.getNumGlyphs(), false)); + area.removeFromTop (roundToInt (bb.getBottom()) + 10); - cancelButton.setBounds (proportionOfWidth (0.55f), buttonY, - proportionOfWidth (0.2f), buttonHeight); + chooserComponent.setBounds (area.removeFromTop (area.getHeight() - buttonHeight - 20)); + Rectangle buttonArea (area.reduced (16, 10)); + + okButton.changeWidthToFitText (buttonHeight); + okButton.setBounds (buttonArea.removeFromRight (okButton.getWidth() + 16)); + + buttonArea.removeFromRight (16); + + cancelButton.changeWidthToFitText (buttonHeight); + cancelButton.setBounds (buttonArea.removeFromRight (cancelButton.getWidth())); + + newFolderButton.changeWidthToFitText (buttonHeight); + newFolderButton.setBounds (buttonArea.removeFromLeft (newFolderButton.getWidth())); } - END_JUCE_NAMESPACE diff --git a/src/gui/components/filebrowser/juce_FileChooserDialogBox.h b/src/gui/components/filebrowser/juce_FileChooserDialogBox.h index 15cbd9db5f..bc0ed9f85e 100644 --- a/src/gui/components/filebrowser/juce_FileChooserDialogBox.h +++ b/src/gui/components/filebrowser/juce_FileChooserDialogBox.h @@ -144,7 +144,6 @@ private: { public: ContentComponent (const String& name, const String& instructions, FileBrowserComponent& chooserComponent); - ~ContentComponent(); void paint (Graphics& g); void resized(); @@ -153,12 +152,15 @@ private: GlyphArrangement text; FileBrowserComponent& chooserComponent; - TextButton okButton, cancelButton; + TextButton okButton, cancelButton, newFolderButton; }; ContentComponent* content; const bool warnAboutOverwritingExistingFiles; + void okButtonPressed(); + void createNewFolder(); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileChooserDialogBox); }; diff --git a/src/gui/components/filebrowser/juce_FileListComponent.cpp b/src/gui/components/filebrowser/juce_FileListComponent.cpp index 62227ec8fe..20402b46e3 100644 --- a/src/gui/components/filebrowser/juce_FileListComponent.cpp +++ b/src/gui/components/filebrowser/juce_FileListComponent.cpp @@ -89,16 +89,13 @@ class FileListItemComponent : public Component, public: //============================================================================== FileListItemComponent (FileListComponent& owner_, TimeSliceThread& thread_) - : owner (owner_), thread (thread_), - highlighted (false), index (0), icon (0) + : owner (owner_), thread (thread_), index (0), highlighted (false) { } ~FileListItemComponent() { thread.removeTimeSliceClient (this); - - clearIcon(); } //============================================================================== @@ -106,8 +103,7 @@ public: { getLookAndFeel().drawFileBrowserRow (g, getWidth(), getHeight(), file.getFileName(), - &icon, - fileSize, modTime, + &icon, fileSize, modTime, isDirectory, highlighted, index, owner); } @@ -130,8 +126,7 @@ public: { thread.removeTimeSliceClient (this); - if (highlighted_ != highlighted - || index_ != index) + if (highlighted_ != highlighted || index_ != index) { index = index_; highlighted = highlighted_; @@ -139,8 +134,7 @@ public: } File newFile; - String newFileSize; - String newModTime; + String newFileSize, newModTime; if (fileInfo != 0) { @@ -156,11 +150,10 @@ public: file = newFile; fileSize = newFileSize; modTime = newModTime; - + icon = Image::null; isDirectory = fileInfo != 0 && fileInfo->isDirectory; - repaint(); - clearIcon(); + repaint(); } if (file != File::nonexistent && icon.isNull() && ! isDirectory) @@ -187,18 +180,11 @@ private: //============================================================================== FileListComponent& owner; TimeSliceThread& thread; - bool highlighted; - int index; File file; - String fileSize; - String modTime; + String fileSize, modTime; Image icon; - bool isDirectory; - - void clearIcon() - { - icon = Image::null; - } + int index; + bool highlighted, isDirectory; void updateIcon (const bool onlyUpdateIfCached) { diff --git a/src/gui/components/juce_Desktop.cpp b/src/gui/components/juce_Desktop.cpp index e9df31d739..659a0f2ce4 100644 --- a/src/gui/components/juce_Desktop.cpp +++ b/src/gui/components/juce_Desktop.cpp @@ -293,7 +293,7 @@ void Desktop::removeGlobalMouseListener (MouseListener* const listener) void Desktop::timerCallback() { - if (lastFakeMouseMove != getRawMousePosition()) + if (lastFakeMouseMove != getMousePosition()) sendMouseMove(); } @@ -303,7 +303,7 @@ void Desktop::sendMouseMove() { startTimer (20); - lastFakeMouseMove = getRawMousePosition(); + lastFakeMouseMove = getMousePosition(); Component* const target = findComponentAt (lastFakeMouseMove); @@ -331,7 +331,7 @@ void Desktop::resetTimer() else startTimer (100); - lastFakeMouseMove = getRawMousePosition(); + lastFakeMouseMove = getMousePosition(); } //============================================================================== diff --git a/src/gui/components/juce_Desktop.h b/src/gui/components/juce_Desktop.h index 11bfc0f481..7d0a02fb78 100644 --- a/src/gui/components/juce_Desktop.h +++ b/src/gui/components/juce_Desktop.h @@ -354,8 +354,6 @@ private: ComponentAnimator animator; - static const Point getRawMousePosition(); - void timerCallback(); void resetTimer(); diff --git a/src/gui/components/menus/juce_PopupMenu.cpp b/src/gui/components/menus/juce_PopupMenu.cpp index 0f731f6cfb..a1d4c02d2f 100644 --- a/src/gui/components/menus/juce_PopupMenu.cpp +++ b/src/gui/components/menus/juce_PopupMenu.cpp @@ -275,6 +275,7 @@ public: contentHeight (0), childYOffset (0), menuCreationTime (Time::getMillisecondCounter()), + lastMouseMoveTime (0), timeEnteredCurrentChildComp (0), scrollAcceleration (1.0) { diff --git a/src/gui/components/mouse/juce_ComponentDragger.cpp b/src/gui/components/mouse/juce_ComponentDragger.cpp index 432fbbbf54..50bb42fa7f 100644 --- a/src/gui/components/mouse/juce_ComponentDragger.cpp +++ b/src/gui/components/mouse/juce_ComponentDragger.cpp @@ -59,7 +59,14 @@ void ComponentDragger::dragComponent (Component* const componentToDrag, const Mo if (componentToDrag != 0) { Rectangle bounds (componentToDrag->getBounds()); - bounds += e.getEventRelativeTo (componentToDrag).getPosition() - mouseDownWithinTarget; + + // If the component is a window, multiple mouse events can get queued while it's in the same position, + // so their coordinates become wrong after the first one moves the window, so in that case, we'll use + // the current mouse position instead of the one that the event contains... + if (componentToDrag->isOnDesktop()) + bounds += componentToDrag->getMouseXYRelative() - mouseDownWithinTarget; + else + bounds += e.getEventRelativeTo (componentToDrag).getPosition() - mouseDownWithinTarget; if (constrainer != 0) constrainer->setBoundsForComponent (componentToDrag, bounds, false, false, false, false); diff --git a/src/gui/components/mouse/juce_MouseInputSource.cpp b/src/gui/components/mouse/juce_MouseInputSource.cpp index 73a371f39c..42033692e8 100644 --- a/src/gui/components/mouse/juce_MouseInputSource.cpp +++ b/src/gui/components/mouse/juce_MouseInputSource.cpp @@ -31,6 +31,7 @@ BEGIN_JUCE_NAMESPACE #include "juce_MouseEvent.h" #include "../juce_Component.h" #include "../../../events/juce_AsyncUpdater.h" +#include "../../../events/juce_MessageManager.h" #include "../lookandfeel/juce_LookAndFeel.h" #include "../windows/juce_ComponentPeer.h" @@ -47,10 +48,6 @@ public: { } - ~MouseInputSourceInternal() - { - } - //============================================================================== bool isDragging() const throw() { @@ -92,8 +89,12 @@ public: return 0; } - const Point getScreenPosition() const throw() + const Point getScreenPosition() { + // This must only be called with the message manager locked! + jassert (MessageManager::getInstance()->currentThreadHasLockedMessageManager()); + + setScreenPos (MouseInputSource::getCurrentMousePosition(), Time::currentTimeMillis(), false); return lastScreenPos + unboundedMouseOffset; } @@ -430,8 +431,8 @@ public: } //============================================================================== - int index; - bool isMouseDevice; + const int index; + const bool isMouseDevice; Point lastScreenPos; ModifierKeys buttonState; @@ -457,7 +458,7 @@ private: Component* component; ModifierKeys buttons; - bool canBePartOfMultipleClickWith (const RecentMouseDown& other, int maxTimeBetween) const + bool canBePartOfMultipleClickWith (const RecentMouseDown& other, const int maxTimeBetween) const { return time - other.time < maxTimeBetween && abs (position.getX() - other.position.getX()) < 8 diff --git a/src/gui/components/mouse/juce_MouseInputSource.h b/src/gui/components/mouse/juce_MouseInputSource.h index 1f9ea880c1..cb3ab4a9c2 100644 --- a/src/gui/components/mouse/juce_MouseInputSource.h +++ b/src/gui/components/mouse/juce_MouseInputSource.h @@ -172,6 +172,8 @@ private: friend class MouseInputSourceInternal; ScopedPointer pimpl; + static const Point getCurrentMousePosition(); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MouseInputSource); }; diff --git a/src/native/common/juce_posix_SharedCode.h b/src/native/common/juce_posix_SharedCode.h index 3b0796e316..78af64d9cb 100644 --- a/src/native/common/juce_posix_SharedCode.h +++ b/src/native/common/juce_posix_SharedCode.h @@ -547,12 +547,12 @@ public: Pimpl (const String& name, const int timeOutMillisecs) : handle (0), refCount (1) { -#if JUCE_MAC + #if JUCE_MAC // (don't use getSpecialLocation() to avoid the temp folder being different for each app) const File temp (File ("~/Library/Caches/Juce").getChildFile (name)); -#else + #else const File temp (File::getSpecialLocation (File::tempDirectory).getChildFile (name)); -#endif + #endif temp.create(); handle = open (temp.getFullPathName().toUTF8(), O_RDWR); diff --git a/src/native/linux/juce_linux_Audio.cpp b/src/native/linux/juce_linux_Audio.cpp index 116c16851e..3bda233c4f 100644 --- a/src/native/linux/juce_linux_Audio.cpp +++ b/src/native/linux/juce_linux_Audio.cpp @@ -225,15 +225,13 @@ public: return false; } - /* -#if JUCE_DEBUG + #if 0 // enable this to dump the config of the devices that get opened snd_output_t* out; snd_output_stdio_attach (&out, stderr, 0); snd_pcm_hw_params_dump (hwParams, out); snd_pcm_sw_params_dump (swParams, out); -#endif - */ + #endif numChannelsRunning = numChannels; diff --git a/src/native/linux/juce_linux_Windowing.cpp b/src/native/linux/juce_linux_Windowing.cpp index ee3247b304..ef271e96f4 100644 --- a/src/native/linux/juce_linux_Windowing.cpp +++ b/src/native/linux/juce_linux_Windowing.cpp @@ -2806,7 +2806,7 @@ bool Desktop::canUseSemiTransparentWindows() throw() && (matchedDepth == desiredDepth); } -const Point Desktop::getRawMousePosition() +const Point MouseInputSource::getCurrentMousePosition() { Window root, child; int x, y, winx, winy; diff --git a/src/native/mac/juce_iphone_UIViewComponentPeer.mm b/src/native/mac/juce_iphone_UIViewComponentPeer.mm index 61a9cb5537..61e9b32ed9 100644 --- a/src/native/mac/juce_iphone_UIViewComponentPeer.mm +++ b/src/native/mac/juce_iphone_UIViewComponentPeer.mm @@ -978,7 +978,7 @@ bool Desktop::canUseSemiTransparentWindows() throw() return true; } -const Point Desktop::getRawMousePosition() +const Point MouseInputSource::getCurrentMousePosition() { return juce_lastMousePos; } diff --git a/src/native/mac/juce_mac_CoreMidi.cpp b/src/native/mac/juce_mac_CoreMidi.cpp index 1ed74d7a4c..e46107b1d4 100644 --- a/src/native/mac/juce_mac_CoreMidi.cpp +++ b/src/native/mac/juce_mac_CoreMidi.cpp @@ -32,7 +32,7 @@ //============================================================================== namespace CoreMidiHelpers { - static bool logError (const OSStatus err, const int lineNum) + bool logError (const OSStatus err, const int lineNum) { if (err == noErr) return true; @@ -46,7 +46,7 @@ namespace CoreMidiHelpers #define CHECK_ERROR(a) CoreMidiHelpers::logError (a, __LINE__) //============================================================================== - static const String getEndpointName (MIDIEndpointRef endpoint, bool isExternal) + const String getEndpointName (MIDIEndpointRef endpoint, bool isExternal) { String result; CFStringRef str = 0; @@ -108,7 +108,7 @@ namespace CoreMidiHelpers return result; } - static const String getConnectedEndpointName (MIDIEndpointRef endpoint) + const String getConnectedEndpointName (MIDIEndpointRef endpoint) { String result; @@ -177,7 +177,7 @@ namespace CoreMidiHelpers return getEndpointName (endpoint, false); } - static MIDIClientRef getGlobalMidiClient() + MIDIClientRef getGlobalMidiClient() { static MIDIClientRef globalMidiClient = 0; @@ -228,8 +228,8 @@ namespace CoreMidiHelpers //============================================================================== class MidiPortAndCallback; - static CriticalSection callbackLock; - static Array activeCallbacks; + CriticalSection callbackLock; + Array activeCallbacks; class MidiPortAndCallback { @@ -280,7 +280,7 @@ namespace CoreMidiHelpers MidiDataConcatenator concatenator; }; - static void midiInputProc (const MIDIPacketList* pktlist, void* readProcRefCon, void* /*srcConnRefCon*/) + void midiInputProc (const MIDIPacketList* pktlist, void* readProcRefCon, void* /*srcConnRefCon*/) { static_cast (readProcRefCon)->handlePackets (pktlist); } diff --git a/src/native/mac/juce_mac_Files.mm b/src/native/mac/juce_mac_Files.mm index 18a72ec719..2ad3682ea3 100644 --- a/src/native/mac/juce_mac_Files.mm +++ b/src/native/mac/juce_mac_Files.mm @@ -57,7 +57,7 @@ void File::findFileSystemRoots (Array& destArray) //============================================================================== -namespace +namespace FileHelpers { bool isFileOnDriveType (const File& f, const char* const* types) { @@ -75,7 +75,7 @@ namespace return false; } - bool juce_isHiddenFile (const String& path) + bool isHiddenFile (const String& path) { #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 const ScopedAutoReleasePool pool; @@ -99,34 +99,55 @@ namespace #endif } -#if JUCE_IOS + #if JUCE_IOS const String getIOSSystemLocation (NSSearchPathDirectory type) { return nsStringToJuce ([NSSearchPathForDirectoriesInDomains (type, NSUserDomainMask, YES) objectAtIndex: 0]); } -#endif + #endif + + bool launchExecutable (const String& pathAndArguments) + { + const char* const argv[4] = { "/bin/sh", "-c", pathAndArguments.toUTF8(), 0 }; + + const int cpid = fork(); + + if (cpid == 0) + { + // Child process + if (execve (argv[0], (char**) argv, 0) < 0) + exit (0); + } + else + { + if (cpid < 0) + return false; + } + + return true; + } } bool File::isOnCDRomDrive() const { const char* const cdTypes[] = { "cd9660", "cdfs", "cddafs", "udf", 0 }; - return isFileOnDriveType (*this, cdTypes); + return FileHelpers::isFileOnDriveType (*this, cdTypes); } bool File::isOnHardDisk() const { const char* const nonHDTypes[] = { "nfs", "smbfs", "ramfs", 0 }; - return ! (isOnCDRomDrive() || isFileOnDriveType (*this, nonHDTypes)); + return ! (isOnCDRomDrive() || FileHelpers::isFileOnDriveType (*this, nonHDTypes)); } bool File::isOnRemovableDrive() const { -#if JUCE_IOS + #if JUCE_IOS return false; // xxx is this possible? -#else + #else const ScopedAutoReleasePool pool; BOOL removable = false; @@ -139,12 +160,12 @@ bool File::isOnRemovableDrive() const type: nil]; return removable; -#endif + #endif } bool File::isHidden() const { - return juce_isHiddenFile (getFullPathName()); + return FileHelpers::isHiddenFile (getFullPathName()); } //============================================================================== @@ -160,7 +181,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) { case userHomeDirectory: resultPath = nsStringToJuce (NSHomeDirectory()); break; -#if JUCE_IOS + #if JUCE_IOS case userDocumentsDirectory: resultPath = getIOSSystemLocation (NSDocumentDirectory); break; case userDesktopDirectory: resultPath = getIOSSystemLocation (NSDesktopDirectory); break; @@ -172,7 +193,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) return tmp.getFullPathName(); } -#else + #else case userDocumentsDirectory: resultPath = "~/Documents"; break; case userDesktopDirectory: resultPath = "~/Desktop"; break; @@ -182,7 +203,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) tmp.createDirectory(); return tmp.getFullPathName(); } -#endif + #endif case userMusicDirectory: resultPath = "~/Music"; break; case userMoviesDirectory: resultPath = "~/Movies"; break; case userApplicationDataDirectory: resultPath = "~/Library"; break; @@ -259,13 +280,13 @@ const String File::getVersion() const //============================================================================== const File File::getLinkedTarget() const { -#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) + #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil]; -#else + #else // (the cast here avoids a deprecation warning) NSString* dest = [((id) [NSFileManager defaultManager]) pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())]; -#endif + #endif if (dest != nil) return File (nsStringToJuce (dest)); @@ -279,9 +300,9 @@ bool File::moveToTrash() const if (! exists()) return true; -#if JUCE_IOS + #if JUCE_IOS return deleteFile(); //xxx is there a trashcan on the iPhone? -#else + #else const ScopedAutoReleasePool pool; NSString* p = juceStringToNS (getFullPathName()); @@ -292,7 +313,7 @@ bool File::moveToTrash() const destination: @"" files: [NSArray arrayWithObject: [p lastPathComponent]] tag: nil ]; -#endif + #endif } //============================================================================== @@ -348,7 +369,7 @@ public: } if (isHidden != 0) - *isHidden = juce_isHiddenFile (path); + *isHidden = FileHelpers::isHiddenFile (path); if (isReadOnly != 0) *isReadOnly = access (path.toUTF8(), W_OK) != 0; @@ -383,32 +404,11 @@ bool DirectoryIterator::NativeIterator::next (String& filenameFound, //============================================================================== -bool juce_launchExecutable (const String& pathAndArguments) -{ - const char* const argv[4] = { "/bin/sh", "-c", pathAndArguments.toUTF8(), 0 }; - - const int cpid = fork(); - - if (cpid == 0) - { - // Child process - if (execve (argv[0], (char**) argv, 0) < 0) - exit (0); - } - else - { - if (cpid < 0) - return false; - } - - return true; -} - bool PlatformUtilities::openDocument (const String& fileName, const String& parameters) { -#if JUCE_IOS + #if JUCE_IOS return [[UIApplication sharedApplication] openURL: [NSURL fileURLWithPath: juceStringToNS (fileName)]]; -#else + #else const ScopedAutoReleasePool pool; if (parameters.isEmpty()) @@ -436,21 +436,21 @@ bool PlatformUtilities::openDocument (const String& fileName, const String& para } else if (File (fileName).exists()) { - ok = juce_launchExecutable ("\"" + fileName + "\" " + parameters); + ok = FileHelpers::launchExecutable ("\"" + fileName + "\" " + parameters); } return ok; -#endif + #endif } void File::revealToUser() const { -#if ! JUCE_IOS + #if ! JUCE_IOS if (exists()) [[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: @""]; else if (getParentDirectory().exists()) getParentDirectory().revealToUser(); -#endif + #endif } //============================================================================== @@ -477,24 +477,24 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename) { const ScopedAutoReleasePool pool; -#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) + #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; -#else + #else // (the cast here avoids a deprecation warning) NSDictionary* fileDict = [((id) [NSFileManager defaultManager]) fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; -#endif + #endif return [fileDict fileHFSTypeCode]; } bool PlatformUtilities::isBundle (const String& filename) { -#if JUCE_IOS + #if JUCE_IOS return false; // xxx can't find a sensible way to do this without trying to open the bundle.. -#else + #else const ScopedAutoReleasePool pool; return [[NSWorkspace sharedWorkspace] isFilePackageAtPath: juceStringToNS (filename)]; -#endif + #endif } #endif diff --git a/src/native/mac/juce_mac_MiscUtilities.mm b/src/native/mac/juce_mac_MiscUtilities.mm index 755352fbe5..b2369770cc 100644 --- a/src/native/mac/juce_mac_MiscUtilities.mm +++ b/src/native/mac/juce_mac_MiscUtilities.mm @@ -143,7 +143,7 @@ bool Desktop::canUseSemiTransparentWindows() throw() return true; } -const Point Desktop::getRawMousePosition() +const Point MouseInputSource::getCurrentMousePosition() { const ScopedAutoReleasePool pool; const NSPoint p ([NSEvent mouseLocation]); diff --git a/src/native/windows/juce_win32_Windowing.cpp b/src/native/windows/juce_win32_Windowing.cpp index 55054818fc..b93e115aeb 100644 --- a/src/native/windows/juce_win32_Windowing.cpp +++ b/src/native/windows/juce_win32_Windowing.cpp @@ -2434,7 +2434,7 @@ void Desktop::createMouseInputSources() mouseSources.add (new MouseInputSource (0, true)); } -const Point Desktop::getRawMousePosition() +const Point MouseInputSource::getCurrentMousePosition() { POINT mousePos; GetCursorPos (&mousePos);