diff --git a/build/linux/platform_specific_code/juce_linux_Windowing.cpp b/build/linux/platform_specific_code/juce_linux_Windowing.cpp index eaaa6b5587..7b6f4ab7c9 100644 --- a/build/linux/platform_specific_code/juce_linux_Windowing.cpp +++ b/build/linux/platform_specific_code/juce_linux_Windowing.cpp @@ -1320,7 +1320,7 @@ public: handleModifierKeysChange(); if (keyDownChange) - handleKeyUpOrDown(); + handleKeyUpOrDown (true); if (keyPressed) handleKeyPress (keyCode, unicodeChar); @@ -1342,7 +1342,7 @@ public: handleModifierKeysChange(); if (keyDownChange) - handleKeyUpOrDown(); + handleKeyUpOrDown (false); break; } diff --git a/build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm b/build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm index 36d0e23ad7..386dae9ee5 100644 --- a/build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm +++ b/build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm @@ -1224,7 +1224,7 @@ bool NSViewComponentPeer::handleKeyEvent (NSEvent* ev, bool isKeyDown) if (([ev modifierFlags] & NSCommandKeyMask) != 0) textCharacter = 0; - used = handleKeyUpOrDown() || used; + used = handleKeyUpOrDown (true) || used; used = handleKeyPress (keyCode, textCharacter) || used; } @@ -1232,7 +1232,7 @@ bool NSViewComponentPeer::handleKeyEvent (NSEvent* ev, bool isKeyDown) } else { - if (handleKeyUpOrDown()) + if (handleKeyUpOrDown (false)) return true; } } diff --git a/build/win32/platform_specific_code/juce_win32_Threads.cpp b/build/win32/platform_specific_code/juce_win32_Threads.cpp index b44116df3d..674117b072 100644 --- a/build/win32/platform_specific_code/juce_win32_Threads.cpp +++ b/build/win32/platform_specific_code/juce_win32_Threads.cpp @@ -194,7 +194,7 @@ bool juce_setThreadPriority (void* threadHandle, int priority) throw() if (threadHandle == 0) threadHandle = GetCurrentThread(); - return (bool) SetThreadPriority (threadHandle, pri); + return SetThreadPriority (threadHandle, pri) != FALSE; } void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) throw() diff --git a/build/win32/platform_specific_code/juce_win32_Windowing.cpp b/build/win32/platform_specific_code/juce_win32_Windowing.cpp index 3f88bfc190..f7e83ee19e 100644 --- a/build/win32/platform_specific_code/juce_win32_Windowing.cpp +++ b/build/win32/platform_specific_code/juce_win32_Windowing.cpp @@ -1483,7 +1483,7 @@ private: sendModifierKeyChangeIfNeeded(); } - return handleKeyUpOrDown() + return handleKeyUpOrDown (false) || Component::getCurrentlyModalComponent() != 0; } @@ -1538,7 +1538,7 @@ private: case VK_F14: case VK_F15: case VK_F16: - used = handleKeyUpOrDown(); + used = handleKeyUpOrDown (true); used = handleKeyPress (extendedKeyModifier | (int) key, 0) || used; break; @@ -1548,11 +1548,11 @@ private: case VK_DIVIDE: case VK_SEPARATOR: case VK_DECIMAL: - used = handleKeyUpOrDown(); + used = handleKeyUpOrDown (true); break; default: - used = handleKeyUpOrDown(); + used = handleKeyUpOrDown (true); { MSG msg; diff --git a/extras/browser plugins/demo/build/mac/JuceBrowserPluginDemo.xcodeproj/project.pbxproj b/extras/browser plugins/demo/build/mac/JuceBrowserPluginDemo.xcodeproj/project.pbxproj index 25d5335740..fd61244103 100644 --- a/extras/browser plugins/demo/build/mac/JuceBrowserPluginDemo.xcodeproj/project.pbxproj +++ b/extras/browser plugins/demo/build/mac/JuceBrowserPluginDemo.xcodeproj/project.pbxproj @@ -26,7 +26,7 @@ 842CC8EF0FA5D26A008C7970 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 842CC8E00FA5D26A008C7970 /* ApplicationServices.framework */; }; 842CC8F00FA5D26A008C7970 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 842CC8E10FA5D26A008C7970 /* CoreFoundation.framework */; }; 842CC94A0FA5D934008C7970 /* juce_NPAPI_MacResource.r in Rez */ = {isa = PBXBuildFile; fileRef = 842CC42A0FA5BD3C008C7970 /* juce_NPAPI_MacResource.r */; }; - 842CCB300FA5F201008C7970 /* JuceBrowserPluginDemo.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.bundle */; }; + 842CCB300FA5F201008C7970 /* JuceBrowserPluginDemo.plugin in CopyFiles */ = {isa = PBXBuildFile; fileRef = 842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.plugin */; }; 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; }; /* End PBXBuildFile section */ @@ -37,7 +37,7 @@ dstPath = "/Library/Internet Plug-Ins"; dstSubfolderSpec = 0; files = ( - 842CCB300FA5F201008C7970 /* JuceBrowserPluginDemo.bundle in CopyFiles */, + 842CCB300FA5F201008C7970 /* JuceBrowserPluginDemo.plugin in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -68,7 +68,7 @@ 842CC8DF0FA5D26A008C7970 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = ""; }; 842CC8E00FA5D26A008C7970 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = ""; }; 842CC8E10FA5D26A008C7970 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; - 842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JuceBrowserPluginDemo.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JuceBrowserPluginDemo.plugin; sourceTree = BUILT_PRODUCTS_DIR; }; 842CC93B0FA5D5D1008C7970 /* test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = test.html; path = ../../test.html; sourceTree = SOURCE_ROOT; }; 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ @@ -168,7 +168,7 @@ 842CC9370FA5D51F008C7970 /* Products */ = { isa = PBXGroup; children = ( - 842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.bundle */, + 842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.plugin */, ); name = Products; sourceTree = ""; @@ -193,7 +193,7 @@ name = JuceBrowserPluginDemo; productInstallPath = "$(HOME)/Library/Bundles"; productName = JuceBrowserPluginDemo; - productReference = 842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.bundle */; + productReference = 842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.plugin */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ diff --git a/extras/browser plugins/wrapper/juce_ActiveX_GlueCode.cpp b/extras/browser plugins/wrapper/juce_ActiveX_GlueCode.cpp index a8a1f53617..6a25827e13 100644 --- a/extras/browser plugins/wrapper/juce_ActiveX_GlueCode.cpp +++ b/extras/browser plugins/wrapper/juce_ActiveX_GlueCode.cpp @@ -827,7 +827,7 @@ STDAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID* ppv) *ppv = 0; - if (CLSIDToJuceString (rclsid) == String (JuceBrowserPlugin_ActiveXCLSID)) + if (CLSIDToJuceString (rclsid).equalsIgnoreCase (String (JuceBrowserPlugin_ActiveXCLSID))) { JuceActiveXObjectFactory* afx = new JuceActiveXObjectFactory(); if (afx->QueryInterface (riid, ppv) == S_OK) @@ -855,7 +855,7 @@ static HRESULT doRegistration (const bool unregister) { const String company (makeLegalRegistryName (JuceBrowserPlugin_Company)); const String plugin (makeLegalRegistryName (JuceBrowserPlugin_Name)); - const String clsID ("{" + String (JuceBrowserPlugin_ActiveXCLSID) + "}"); + const String clsID ("{" + String (JuceBrowserPlugin_ActiveXCLSID).toUpperCase() + "}"); const String root ("HKEY_CLASSES_ROOT\\"); const String companyDotPlugin (company + "." + plugin); const String companyDotPluginCur (companyDotPlugin + ".1"); diff --git a/extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp b/extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp index 86a6bd5bb9..c6f11bca6f 100644 --- a/extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp +++ b/extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp @@ -440,12 +440,20 @@ public: NSView* findViewAt (NSView* parent, float x, float y) const { - NSRect r = [parent frame]; - x -= r.origin.x; - y -= r.origin.y; + NSRect frame = [parent frame]; + NSRect bounds = [parent bounds]; + x -= frame.origin.x; + y -= frame.origin.y; - if (x >= 0 && x < r.size.width && y >= 0 && y < r.size.height) + Rectangle rr (frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); + Rectangle rr2 (bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); + //log (String ((int) x) + ", " + String ((int) y) + " - " + nsStringToJuce([parent description]) + " " + rr.toString() + " " + rr2.toString()); + + if (x >= 0 && x < frame.size.width && y >= 0 && y < frame.size.height) { + x += bounds.origin.x; // adjust for scrolling panels + y += bounds.origin.y; + for (int i = [[parent subviews] count]; --i >= 0;) { NSView* v = (NSView*) [[parent subviews] objectAtIndex: i]; @@ -483,17 +491,46 @@ public: if (windowRef != 0) { NSWindow* win = [[[NSWindow alloc] initWithWindowRef: windowRef] autorelease]; - parentView = findViewAt ([win contentView], window->x + 0.5f, window->y + 0.5f); - log (nsStringToJuce ([parentView description])); + const Rectangle clip (window->clipRect.left, window->clipRect.top, + window->clipRect.right - window->clipRect.left, + window->clipRect.bottom - window->clipRect.top); + const Rectangle target ((int) window->x, (int) window->y, (int) window->width, (int) window->height); + const Rectangle intersection (clip.getIntersection (target)); - if (! isBrowserContentView (parentView)) - parentView = currentParentView; + // in firefox the clip rect is usually out of step with the target rect, but in safari it matches + log ("plugin window clip: " + clip.toString()); + log ("plugin window target: " + target.toString()); + log ("plugin window intersection: " + intersection.toString()); + + if (! intersection.isEmpty()) + { + NSView* content = [win contentView]; + + float wx = (float) intersection.getCentreX(); + float wy = (float) intersection.getCentreY(); + + NSRect v = [content convertRect: [content frame] toView: nil]; + NSRect w = [win frame]; + + log ("wx: " + Rectangle (v.origin.x, v.origin.y, v.size.width, v.size.height).toString() + + " " + Rectangle (w.origin.x, w.origin.y, w.size.width, w.size.height).toString()); + + // adjust the requested window pos to deal with the content view's origin within the window + wy -= w.size.height - (v.origin.y + v.size.height); + + parentView = findViewAt (content, wx, wy); + + if (! isBrowserContentView (parentView)) + parentView = currentParentView; + } + + log ("parent: " + nsStringToJuce ([parentView description])); } if (parentView != currentParentView) { - //log ("new view: " + nsStringToJuce ([parentView description])); + log ("new view: " + nsStringToJuce ([parentView description])); removeFromDesktop(); setVisible (false); @@ -894,7 +931,6 @@ public: private: bool shouldRetainBrowserObject() const { -#if JUCE_MAC const String version (browser.uagent (npp)); if (! version.containsIgnoreCase (T(" AppleWebKit/"))) @@ -903,9 +939,6 @@ private: int versionNum = version.fromFirstOccurrenceOf (T(" AppleWebKit/"), false, true).getIntValue(); return versionNum == 0 || versionNum >= 420; -#else - return true; -#endif } }; diff --git a/extras/browser plugins/wrapper/juce_NPAPI_GlueCode.mm b/extras/browser plugins/wrapper/juce_NPAPI_GlueCode.mm index d46000cbd6..4da7c01710 100644 --- a/extras/browser plugins/wrapper/juce_NPAPI_GlueCode.mm +++ b/extras/browser plugins/wrapper/juce_NPAPI_GlueCode.mm @@ -1,38 +1,38 @@ -/* - ============================================================================== - - This file is part of the JUCE library - "Jules' Utility Class Extensions" - Copyright 2004-7 by Raw Material Software ltd. - - ------------------------------------------------------------------------------ - - JUCE can be redistributed and/or modified under the terms of the - GNU General Public License, as published by the Free Software Foundation; - either version 2 of the License, or (at your option) any later version. - - JUCE is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with JUCE; if not, visit www.gnu.org/licenses or write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - ------------------------------------------------------------------------------ - - If you'd like to release a closed-source product which uses JUCE, commercial - licenses are also available: visit www.rawmaterialsoftware.com/juce for - more information. - - ============================================================================== -*/ - -//============================================================================== -/** The only reason this file exists is to wrap the .cpp file inside a .mm file to - make the compiler treat it as obj-C. -*/ -#include -#define JUCE_NPAPI_WRAPPED_IN_MM 1 -#include "juce_NPAPI_GlueCode.cpp" +/* + ============================================================================== + + This file is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright 2004-7 by Raw Material Software ltd. + + ------------------------------------------------------------------------------ + + JUCE can be redistributed and/or modified under the terms of the + GNU General Public License, as published by the Free Software Foundation; + either version 2 of the License, or (at your option) any later version. + + JUCE is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with JUCE; if not, visit www.gnu.org/licenses or write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------------ + + If you'd like to release a closed-source product which uses JUCE, commercial + licenses are also available: visit www.rawmaterialsoftware.com/juce for + more information. + + ============================================================================== +*/ + +//============================================================================== +/** The only reason this file exists is to wrap the .cpp file inside a .mm file to + make the compiler treat it as obj-C. +*/ +#include +#define JUCE_NPAPI_WRAPPED_IN_MM 1 +#include "juce_NPAPI_GlueCode.cpp" diff --git a/extras/the jucer/src/model/jucer_JucerDocument.cpp b/extras/the jucer/src/model/jucer_JucerDocument.cpp index bdd97a5890..3cd5c45e99 100644 --- a/extras/the jucer/src/model/jucer_JucerDocument.cpp +++ b/extras/the jucer/src/model/jucer_JucerDocument.cpp @@ -300,7 +300,7 @@ void JucerDocument::getOptionalMethods (StringArray& baseClasses, addMethod ("Component", "void", "mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)", "", baseClasses, returnValues, methods, initialContents); addMethod ("Component", "bool", "keyPressed (const KeyPress& key)", "return false; // Return true if your handler uses this key event, or false to allow it to be passed-on.", baseClasses, returnValues, methods, initialContents); - addMethod ("Component", "bool", "keyStateChanged()", "return false; // Return true if your handler uses this key event, or false to allow it to be passed-on.", baseClasses, returnValues, methods, initialContents); + addMethod ("Component", "bool", "keyStateChanged (const bool isKeyDown)", "return false; // Return true if your handler uses this key event, or false to allow it to be passed-on.", baseClasses, returnValues, methods, initialContents); addMethod ("Component", "void", "modifierKeysChanged (const ModifierKeys& modifiers)", "", baseClasses, returnValues, methods, initialContents); addMethod ("Component", "void", "focusGained (FocusChangeType cause)", "", baseClasses, returnValues, methods, initialContents); diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 600702f700..e1715ac855 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -3782,7 +3782,7 @@ const String var::toString() const throw() switch (type) { case voidType: - case objectType: return "Object 0x" + String::toHexString ((pointer_sized_int) value.objectValue); + case objectType: return "Object 0x" + String::toHexString ((int) (pointer_sized_int) value.objectValue); case intType: return String (value.intValue); case boolType: return value.boolValue ? T("1") : T("0"); case doubleType: return String (value.doubleValue); @@ -3793,6 +3793,11 @@ const String var::toString() const throw() return String::empty; } +var::operator const String() const throw() +{ + return toString(); +} + DynamicObject* var::getObject() const throw() { return type == objectType ? value.objectValue : 0; @@ -29757,7 +29762,7 @@ public: innerWrapper->setSize (getWidth(), getHeight()); } - bool keyStateChanged() + bool keyStateChanged (const bool) { return false; } @@ -31846,7 +31851,7 @@ public: } #endif - bool keyStateChanged() + bool keyStateChanged (const bool) { return pluginWantsKeys; } @@ -41608,7 +41613,7 @@ bool Component::keyPressed (const KeyPress&) return false; } -bool Component::keyStateChanged() +bool Component::keyStateChanged (const bool /*isKeyDown*/) { return false; } @@ -42719,7 +42724,7 @@ bool Button::isRegisteredForShortcut (const KeyPress& key) const throw() return false; } -bool Button::keyStateChanged (Component*) +bool Button::keyStateChanged (const bool, Component*) { if (! isEnabled()) return false; @@ -44125,13 +44130,14 @@ bool ComboBox::keyPressed (const KeyPress& key) return used; } -bool ComboBox::keyStateChanged() +bool ComboBox::keyStateChanged (const bool isKeyDown) { // only forward key events that aren't used by this component - return KeyPress::isKeyCurrentlyDown (KeyPress::upKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::leftKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::downKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::rightKey); + return isKeyDown + && (KeyPress::isKeyCurrentlyDown (KeyPress::upKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::leftKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::downKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::rightKey)); } void ComboBox::focusGained (FocusChangeType) @@ -45402,15 +45408,16 @@ bool ListBox::keyPressed (const KeyPress& key) return true; } -bool ListBox::keyStateChanged() +bool ListBox::keyStateChanged (const bool isKeyDown) { - return KeyPress::isKeyCurrentlyDown (KeyPress::upKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::pageUpKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::downKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::pageDownKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::homeKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::endKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::returnKey); + return isKeyDown + && (KeyPress::isKeyCurrentlyDown (KeyPress::upKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::pageUpKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::downKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::pageDownKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::homeKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::endKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::returnKey)); } void ListBox::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY) @@ -50494,8 +50501,16 @@ bool TextEditor::keyPressed (const KeyPress& key) return true; } -bool TextEditor::keyStateChanged() +bool TextEditor::keyStateChanged (const bool isKeyDown) { + if (! isKeyDown) + return false; + +#if JUCE_WIN32 + if (KeyPress (KeyPress::F4Key, ModifierKeys::altModifier, 0).isCurrentlyDown()) + return false; // We need to explicitly allow alt-F4 to pass through on Windows +#endif + // (overridden to avoid forwarding key events to the parent) return ! ModifierKeys::getCurrentModifiers().isCommandDown(); } @@ -56014,7 +56029,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE -bool KeyListener::keyStateChanged (Component*) +bool KeyListener::keyStateChanged (const bool, Component*) { return false; } @@ -56471,7 +56486,7 @@ public: return true; } - bool keyStateChanged() + bool keyStateChanged (const bool) { return true; } @@ -57120,7 +57135,7 @@ bool KeyPressMappingSet::keyPressed (const KeyPress& key, return used; } -bool KeyPressMappingSet::keyStateChanged (Component* originatingComponent) +bool KeyPressMappingSet::keyStateChanged (const bool /*isKeyDown*/, Component* originatingComponent) { bool used = false; const uint32 now = Time::getMillisecondCounter(); @@ -57185,7 +57200,7 @@ bool KeyPressMappingSet::keyStateChanged (Component* originatingComponent) void KeyPressMappingSet::globalFocusChanged (Component* focusedComponent) { if (focusedComponent != 0) - focusedComponent->keyStateChanged(); + focusedComponent->keyStateChanged (false); } END_JUCE_NAMESPACE @@ -66911,7 +66926,7 @@ public: currentlyOver->itemDragEnter (dragDescLocal, source, relX, relY); } } - else if (currentlyOverWatcher != 0 && ! currentlyOverWatcher->hasBeenDeleted()) + else if (currentlyOverWatcher != 0 && currentlyOverWatcher->hasBeenDeleted()) { currentlyOver = 0; deleteAndZero (currentlyOverWatcher); @@ -71693,7 +71708,7 @@ void MidiKeyboardComponent::setKeyPressBaseOctave (const int newOctaveNumber) keyMappingOctave = newOctaveNumber; } -bool MidiKeyboardComponent::keyStateChanged() +bool MidiKeyboardComponent::keyStateChanged (const bool /*isKeyDown*/) { bool keyPressUsed = false; @@ -73238,7 +73253,7 @@ bool ComponentPeer::handleKeyPress (const int keyCode, return keyWasUsed; } -bool ComponentPeer::handleKeyUpOrDown() +bool ComponentPeer::handleKeyUpOrDown (const bool isKeyDown) { updateCurrentModifiers(); @@ -73260,7 +73275,7 @@ bool ComponentPeer::handleKeyUpOrDown() { const ComponentDeletionWatcher deletionChecker (target); - keyWasUsed = target->keyStateChanged(); + keyWasUsed = target->keyStateChanged (isKeyDown); if (keyWasUsed || deletionChecker.hasBeenDeleted()) break; @@ -73269,7 +73284,7 @@ bool ComponentPeer::handleKeyUpOrDown() { for (int i = target->keyListeners_->size(); --i >= 0;) { - keyWasUsed = ((KeyListener*) target->keyListeners_->getUnchecked(i))->keyStateChanged (target); + keyWasUsed = ((KeyListener*) target->keyListeners_->getUnchecked(i))->keyStateChanged (isKeyDown, target); if (keyWasUsed || deletionChecker.hasBeenDeleted()) return keyWasUsed; @@ -241661,7 +241676,7 @@ bool juce_setThreadPriority (void* threadHandle, int priority) throw() if (threadHandle == 0) threadHandle = GetCurrentThread(); - return (bool) SetThreadPriority (threadHandle, pri); + return SetThreadPriority (threadHandle, pri) != FALSE; } void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) throw() @@ -245015,7 +245030,7 @@ private: sendModifierKeyChangeIfNeeded(); } - return handleKeyUpOrDown() + return handleKeyUpOrDown (false) || Component::getCurrentlyModalComponent() != 0; } @@ -245070,7 +245085,7 @@ private: case VK_F14: case VK_F15: case VK_F16: - used = handleKeyUpOrDown(); + used = handleKeyUpOrDown (true); used = handleKeyPress (extendedKeyModifier | (int) key, 0) || used; break; @@ -245080,11 +245095,11 @@ private: case VK_DIVIDE: case VK_SEPARATOR: case VK_DECIMAL: - used = handleKeyUpOrDown(); + used = handleKeyUpOrDown (true); break; default: - used = handleKeyUpOrDown(); + used = handleKeyUpOrDown (true); { MSG msg; @@ -263914,7 +263929,7 @@ public: handleModifierKeysChange(); if (keyDownChange) - handleKeyUpOrDown(); + handleKeyUpOrDown (true); if (keyPressed) handleKeyPress (keyCode, unicodeChar); @@ -263936,7 +263951,7 @@ public: handleModifierKeysChange(); if (keyDownChange) - handleKeyUpOrDown(); + handleKeyUpOrDown (false); break; } @@ -269413,7 +269428,7 @@ bool NSViewComponentPeer::handleKeyEvent (NSEvent* ev, bool isKeyDown) if (([ev modifierFlags] & NSCommandKeyMask) != 0) textCharacter = 0; - used = handleKeyUpOrDown() || used; + used = handleKeyUpOrDown (true) || used; used = handleKeyPress (keyCode, textCharacter) || used; } @@ -269421,7 +269436,7 @@ bool NSViewComponentPeer::handleKeyEvent (NSEvent* ev, bool isKeyDown) } else { - if (handleKeyUpOrDown()) + if (handleKeyUpOrDown (false)) return true; } } diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 74207f0d23..0ed1697585 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -11435,6 +11435,7 @@ public: operator int() const throw(); operator bool() const throw(); operator double() const throw(); + operator const String() const throw(); const String toString() const throw(); DynamicObject* getObject() const throw(); @@ -16293,10 +16294,15 @@ public: false, then the key will be passed to other components that might want to use it. @param originatingComponent the component that received the key event + @param isKeyDown true if a key is being pressed, false if one is being released @see KeyPress, Component::keyStateChanged */ - virtual bool keyStateChanged (Component* originatingComponent); + virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent); +private: + // (dummy method to cause a deliberate compile error - if you hit this, you need to update your + // subclass to use the new parameters to keyStateChanged) + virtual void keyStateChanged (Component*) {}; }; #endif // __JUCE_KEYLISTENER_JUCEHEADER__ @@ -20933,7 +20939,7 @@ public: /** Called whenever a key is pressed or released. Returns true if the keystroke was used. */ - bool handleKeyUpOrDown(); + bool handleKeyUpOrDown (const bool isKeyDown); /** Called whenever a modifier key is pressed or released. */ void handleModifierKeysChange(); @@ -22444,9 +22450,11 @@ public: To find out which keys are up or down at any time, see the KeyPress::isKeyCurrentlyDown() method. + @param isKeyDown true if a key has been pressed; false if it has been released + @see keyPressed, KeyPress, getCurrentlyFocusedComponent, addKeyListener */ - virtual bool keyStateChanged(); + virtual bool keyStateChanged (const bool isKeyDown); /** Called when a modifier key is pressed or released. @@ -23060,6 +23068,10 @@ private: const Component& operator= (const Component&); + // (dummy method to cause a deliberate compile error - if you hit this, you need to update your + // subclass to use the new parameters to keyStateChanged) + virtual void keyStateChanged() {}; + protected: /** @internal */ virtual void internalRepaint (int x, int y, int w, int h); @@ -29258,7 +29270,7 @@ public: To create a node, call AudioProcessorGraph::addNode(). */ - class Node : public ReferenceCountedObject + class JUCE_API Node : public ReferenceCountedObject { public: /** Destructor. @@ -29307,7 +29319,7 @@ public: To create a connection, use AudioProcessorGraph::addConnection(). */ - struct Connection + struct JUCE_API Connection { public: @@ -29465,7 +29477,7 @@ public: @see AudioProcessorGraph */ - class AudioGraphIOProcessor : public AudioPluginInstance + class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance { public: /** Specifies the mode in which this processor will operate. @@ -30630,7 +30642,7 @@ protected: /** @internal */ bool keyPressed (const KeyPress& key, Component* originatingComponent); /** @internal */ - bool keyStateChanged (Component* originatingComponent); + bool keyStateChanged (const bool isKeyDown, Component* originatingComponent); /** @internal */ void paint (Graphics& g); /** @internal */ @@ -32501,7 +32513,7 @@ class Component; types[i]->scanForDevices(); // This must be called before getting the list of devices - String deviceNames (types[i]->getDeviceNames()); // This will now return a list of available devices of this type + StringArray deviceNames (types[i]->getDeviceNames()); // This will now return a list of available devices of this type for (int j = 0; j < deviceNames.size(); ++j) { @@ -33521,7 +33533,7 @@ l */ /** @internal */ bool keyPressed (const KeyPress& key); /** @internal */ - bool keyStateChanged(); + bool keyStateChanged (const bool isKeyDown); /** @internal */ void focusGained (FocusChangeType cause); /** @internal */ @@ -34304,7 +34316,7 @@ public: /** @internal */ void resized(); /** @internal */ - bool keyStateChanged(); + bool keyStateChanged (const bool isKeyDown); /** @internal */ bool keyPressed (const KeyPress&); @@ -36281,7 +36293,7 @@ public: /** @internal */ bool keyPressed (const KeyPress& key); /** @internal */ - bool keyStateChanged(); + bool keyStateChanged (const bool isKeyDown); /** @internal */ void paint (Graphics& g); /** @internal */ @@ -43486,7 +43498,7 @@ public: /** @internal */ bool keyPressed (const KeyPress& key, Component* originatingComponent); /** @internal */ - bool keyStateChanged (Component* originatingComponent); + bool keyStateChanged (const bool isKeyDown, Component* originatingComponent); /** @internal */ void globalFocusChanged (Component* focusedComponent); @@ -52713,7 +52725,7 @@ public: /** @internal */ void timerCallback(); /** @internal */ - bool keyStateChanged(); + bool keyStateChanged (const bool isKeyDown); /** @internal */ void focusLost (FocusChangeType cause); /** @internal */ diff --git a/src/juce_appframework/audio/plugins/formats/juce_AudioUnitPluginFormat.mm b/src/juce_appframework/audio/plugins/formats/juce_AudioUnitPluginFormat.mm index d7b0efc70d..a74910a6d5 100644 --- a/src/juce_appframework/audio/plugins/formats/juce_AudioUnitPluginFormat.mm +++ b/src/juce_appframework/audio/plugins/formats/juce_AudioUnitPluginFormat.mm @@ -1004,7 +1004,7 @@ public: } //============================================================================== - bool keyStateChanged() + bool keyStateChanged (const bool) { return false; } diff --git a/src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp b/src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp index 864a2d7711..49498a8973 100644 --- a/src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp +++ b/src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp @@ -1269,7 +1269,7 @@ public: #endif //============================================================================== - bool keyStateChanged() + bool keyStateChanged (const bool) { return pluginWantsKeys; } diff --git a/src/juce_appframework/audio/processors/juce_AudioProcessorGraph.h b/src/juce_appframework/audio/processors/juce_AudioProcessorGraph.h index bf93c8b01a..f2aaee3039 100644 --- a/src/juce_appframework/audio/processors/juce_AudioProcessorGraph.h +++ b/src/juce_appframework/audio/processors/juce_AudioProcessorGraph.h @@ -72,7 +72,7 @@ public: To create a node, call AudioProcessorGraph::addNode(). */ - class Node : public ReferenceCountedObject + class JUCE_API Node : public ReferenceCountedObject { public: /** Destructor. @@ -125,7 +125,7 @@ public: To create a connection, use AudioProcessorGraph::addConnection(). */ - struct Connection + struct JUCE_API Connection { public: //============================================================================== @@ -289,7 +289,7 @@ public: @see AudioProcessorGraph */ - class AudioGraphIOProcessor : public AudioPluginInstance + class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance { public: /** Specifies the mode in which this processor will operate. diff --git a/src/juce_appframework/gui/components/buttons/juce_Button.cpp b/src/juce_appframework/gui/components/buttons/juce_Button.cpp index d5c26f0cfa..8623b71e63 100644 --- a/src/juce_appframework/gui/components/buttons/juce_Button.cpp +++ b/src/juce_appframework/gui/components/buttons/juce_Button.cpp @@ -599,7 +599,7 @@ bool Button::isRegisteredForShortcut (const KeyPress& key) const throw() return false; } -bool Button::keyStateChanged (Component*) +bool Button::keyStateChanged (const bool, Component*) { if (! isEnabled()) return false; diff --git a/src/juce_appframework/gui/components/buttons/juce_Button.h b/src/juce_appframework/gui/components/buttons/juce_Button.h index 3a3b9cb32e..c45e69db50 100644 --- a/src/juce_appframework/gui/components/buttons/juce_Button.h +++ b/src/juce_appframework/gui/components/buttons/juce_Button.h @@ -447,7 +447,7 @@ protected: /** @internal */ bool keyPressed (const KeyPress& key, Component* originatingComponent); /** @internal */ - bool keyStateChanged (Component* originatingComponent); + bool keyStateChanged (const bool isKeyDown, Component* originatingComponent); /** @internal */ void paint (Graphics& g); /** @internal */ diff --git a/src/juce_appframework/gui/components/controls/juce_ComboBox.cpp b/src/juce_appframework/gui/components/controls/juce_ComboBox.cpp index 9f2521b66f..b1620191fe 100644 --- a/src/juce_appframework/gui/components/controls/juce_ComboBox.cpp +++ b/src/juce_appframework/gui/components/controls/juce_ComboBox.cpp @@ -501,13 +501,14 @@ bool ComboBox::keyPressed (const KeyPress& key) return used; } -bool ComboBox::keyStateChanged() +bool ComboBox::keyStateChanged (const bool isKeyDown) { // only forward key events that aren't used by this component - return KeyPress::isKeyCurrentlyDown (KeyPress::upKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::leftKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::downKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::rightKey); + return isKeyDown + && (KeyPress::isKeyCurrentlyDown (KeyPress::upKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::leftKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::downKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::rightKey)); } //============================================================================== diff --git a/src/juce_appframework/gui/components/controls/juce_ComboBox.h b/src/juce_appframework/gui/components/controls/juce_ComboBox.h index 64b04dbf1c..076e47b578 100644 --- a/src/juce_appframework/gui/components/controls/juce_ComboBox.h +++ b/src/juce_appframework/gui/components/controls/juce_ComboBox.h @@ -360,7 +360,7 @@ public: /** @internal */ void resized(); /** @internal */ - bool keyStateChanged(); + bool keyStateChanged (const bool isKeyDown); /** @internal */ bool keyPressed (const KeyPress&); diff --git a/src/juce_appframework/gui/components/controls/juce_ListBox.cpp b/src/juce_appframework/gui/components/controls/juce_ListBox.cpp index bb9a90b9b0..1fc8419015 100644 --- a/src/juce_appframework/gui/components/controls/juce_ListBox.cpp +++ b/src/juce_appframework/gui/components/controls/juce_ListBox.cpp @@ -791,15 +791,16 @@ bool ListBox::keyPressed (const KeyPress& key) return true; } -bool ListBox::keyStateChanged() +bool ListBox::keyStateChanged (const bool isKeyDown) { - return KeyPress::isKeyCurrentlyDown (KeyPress::upKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::pageUpKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::downKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::pageDownKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::homeKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::endKey) - || KeyPress::isKeyCurrentlyDown (KeyPress::returnKey); + return isKeyDown + && (KeyPress::isKeyCurrentlyDown (KeyPress::upKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::pageUpKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::downKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::pageDownKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::homeKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::endKey) + || KeyPress::isKeyCurrentlyDown (KeyPress::returnKey)); } void ListBox::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY) diff --git a/src/juce_appframework/gui/components/controls/juce_ListBox.h b/src/juce_appframework/gui/components/controls/juce_ListBox.h index 39adf8ee27..1220142d04 100644 --- a/src/juce_appframework/gui/components/controls/juce_ListBox.h +++ b/src/juce_appframework/gui/components/controls/juce_ListBox.h @@ -540,7 +540,7 @@ public: /** @internal */ bool keyPressed (const KeyPress& key); /** @internal */ - bool keyStateChanged(); + bool keyStateChanged (const bool isKeyDown); /** @internal */ void paint (Graphics& g); /** @internal */ diff --git a/src/juce_appframework/gui/components/controls/juce_TextEditor.cpp b/src/juce_appframework/gui/components/controls/juce_TextEditor.cpp index 783ac3cab5..65ef9a109b 100644 --- a/src/juce_appframework/gui/components/controls/juce_TextEditor.cpp +++ b/src/juce_appframework/gui/components/controls/juce_TextEditor.cpp @@ -2081,8 +2081,16 @@ bool TextEditor::keyPressed (const KeyPress& key) return true; } -bool TextEditor::keyStateChanged() +bool TextEditor::keyStateChanged (const bool isKeyDown) { + if (! isKeyDown) + return false; + +#if JUCE_WIN32 + if (KeyPress (KeyPress::F4Key, ModifierKeys::altModifier, 0).isCurrentlyDown()) + return false; // We need to explicitly allow alt-F4 to pass through on Windows +#endif + // (overridden to avoid forwarding key events to the parent) return ! ModifierKeys::getCurrentModifiers().isCommandDown(); } diff --git a/src/juce_appframework/gui/components/controls/juce_TextEditor.h b/src/juce_appframework/gui/components/controls/juce_TextEditor.h index 3b6e5d4129..10e4346982 100644 --- a/src/juce_appframework/gui/components/controls/juce_TextEditor.h +++ b/src/juce_appframework/gui/components/controls/juce_TextEditor.h @@ -531,7 +531,7 @@ l */ /** @internal */ bool keyPressed (const KeyPress& key); /** @internal */ - bool keyStateChanged(); + bool keyStateChanged (const bool isKeyDown); /** @internal */ void focusGained (FocusChangeType cause); /** @internal */ diff --git a/src/juce_appframework/gui/components/juce_Component.cpp b/src/juce_appframework/gui/components/juce_Component.cpp index cff649ec2c..9dc791b549 100644 --- a/src/juce_appframework/gui/components/juce_Component.cpp +++ b/src/juce_appframework/gui/components/juce_Component.cpp @@ -3534,7 +3534,7 @@ bool Component::keyPressed (const KeyPress&) return false; } -bool Component::keyStateChanged() +bool Component::keyStateChanged (const bool /*isKeyDown*/) { return false; } diff --git a/src/juce_appframework/gui/components/juce_Component.h b/src/juce_appframework/gui/components/juce_Component.h index dfacf8a92a..c7d1927d8b 100644 --- a/src/juce_appframework/gui/components/juce_Component.h +++ b/src/juce_appframework/gui/components/juce_Component.h @@ -1481,10 +1481,12 @@ public: To find out which keys are up or down at any time, see the KeyPress::isKeyCurrentlyDown() method. + + @param isKeyDown true if a key has been pressed; false if it has been released @see keyPressed, KeyPress, getCurrentlyFocusedComponent, addKeyListener */ - virtual bool keyStateChanged(); + virtual bool keyStateChanged (const bool isKeyDown); /** Called when a modifier key is pressed or released. @@ -2111,6 +2113,10 @@ private: const Component& operator= (const Component&); + // (dummy method to cause a deliberate compile error - if you hit this, you need to update your + // subclass to use the new parameters to keyStateChanged) + virtual void keyStateChanged() {}; + protected: /** @internal */ virtual void internalRepaint (int x, int y, int w, int h); diff --git a/src/juce_appframework/gui/components/keyboard/juce_KeyListener.cpp b/src/juce_appframework/gui/components/keyboard/juce_KeyListener.cpp index e2ef3f7e3f..ad94822473 100644 --- a/src/juce_appframework/gui/components/keyboard/juce_KeyListener.cpp +++ b/src/juce_appframework/gui/components/keyboard/juce_KeyListener.cpp @@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE //============================================================================== -bool KeyListener::keyStateChanged (Component*) +bool KeyListener::keyStateChanged (const bool, Component*) { return false; } diff --git a/src/juce_appframework/gui/components/keyboard/juce_KeyListener.h b/src/juce_appframework/gui/components/keyboard/juce_KeyListener.h index 4422c06ccd..1a88db661f 100644 --- a/src/juce_appframework/gui/components/keyboard/juce_KeyListener.h +++ b/src/juce_appframework/gui/components/keyboard/juce_KeyListener.h @@ -76,10 +76,15 @@ public: false, then the key will be passed to other components that might want to use it. @param originatingComponent the component that received the key event + @param isKeyDown true if a key is being pressed, false if one is being released @see KeyPress, Component::keyStateChanged */ - virtual bool keyStateChanged (Component* originatingComponent); + virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent); +private: + // (dummy method to cause a deliberate compile error - if you hit this, you need to update your + // subclass to use the new parameters to keyStateChanged) + virtual void keyStateChanged (Component*) {}; }; diff --git a/src/juce_appframework/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp b/src/juce_appframework/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp index 18a0a02e17..8b1d826835 100644 --- a/src/juce_appframework/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp +++ b/src/juce_appframework/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp @@ -494,7 +494,7 @@ public: return true; } - bool keyStateChanged() + bool keyStateChanged (const bool) { return true; } diff --git a/src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.cpp b/src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.cpp index c104e359fc..c253df20c2 100644 --- a/src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.cpp +++ b/src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.cpp @@ -368,7 +368,7 @@ bool KeyPressMappingSet::keyPressed (const KeyPress& key, return used; } -bool KeyPressMappingSet::keyStateChanged (Component* originatingComponent) +bool KeyPressMappingSet::keyStateChanged (const bool /*isKeyDown*/, Component* originatingComponent) { bool used = false; const uint32 now = Time::getMillisecondCounter(); @@ -433,7 +433,7 @@ bool KeyPressMappingSet::keyStateChanged (Component* originatingComponent) void KeyPressMappingSet::globalFocusChanged (Component* focusedComponent) { if (focusedComponent != 0) - focusedComponent->keyStateChanged(); + focusedComponent->keyStateChanged (false); } diff --git a/src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.h b/src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.h index b3b2aaea66..a1a8d63348 100644 --- a/src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.h +++ b/src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.h @@ -230,7 +230,7 @@ public: /** @internal */ bool keyPressed (const KeyPress& key, Component* originatingComponent); /** @internal */ - bool keyStateChanged (Component* originatingComponent); + bool keyStateChanged (const bool isKeyDown, Component* originatingComponent); /** @internal */ void globalFocusChanged (Component* focusedComponent); diff --git a/src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp b/src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp index f437ca2f06..4e75bfa46f 100644 --- a/src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp +++ b/src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp @@ -284,7 +284,7 @@ public: currentlyOver->itemDragEnter (dragDescLocal, source, relX, relY); } } - else if (currentlyOverWatcher != 0 && ! currentlyOverWatcher->hasBeenDeleted()) + else if (currentlyOverWatcher != 0 && currentlyOverWatcher->hasBeenDeleted()) { currentlyOver = 0; deleteAndZero (currentlyOverWatcher); diff --git a/src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.cpp b/src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.cpp index 482874a229..a7bee924fa 100644 --- a/src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.cpp +++ b/src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.cpp @@ -836,7 +836,7 @@ void MidiKeyboardComponent::setKeyPressBaseOctave (const int newOctaveNumber) keyMappingOctave = newOctaveNumber; } -bool MidiKeyboardComponent::keyStateChanged() +bool MidiKeyboardComponent::keyStateChanged (const bool /*isKeyDown*/) { bool keyPressUsed = false; diff --git a/src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.h b/src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.h index 04d5fadf38..1d3c7910dc 100644 --- a/src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.h +++ b/src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.h @@ -298,7 +298,7 @@ public: /** @internal */ void timerCallback(); /** @internal */ - bool keyStateChanged(); + bool keyStateChanged (const bool isKeyDown); /** @internal */ void focusLost (FocusChangeType cause); /** @internal */ diff --git a/src/juce_appframework/gui/components/windows/juce_ComponentPeer.cpp b/src/juce_appframework/gui/components/windows/juce_ComponentPeer.cpp index 9a00da1d9f..51a1c5dcf6 100644 --- a/src/juce_appframework/gui/components/windows/juce_ComponentPeer.cpp +++ b/src/juce_appframework/gui/components/windows/juce_ComponentPeer.cpp @@ -473,7 +473,7 @@ bool ComponentPeer::handleKeyPress (const int keyCode, return keyWasUsed; } -bool ComponentPeer::handleKeyUpOrDown() +bool ComponentPeer::handleKeyUpOrDown (const bool isKeyDown) { updateCurrentModifiers(); @@ -495,7 +495,7 @@ bool ComponentPeer::handleKeyUpOrDown() { const ComponentDeletionWatcher deletionChecker (target); - keyWasUsed = target->keyStateChanged(); + keyWasUsed = target->keyStateChanged (isKeyDown); if (keyWasUsed || deletionChecker.hasBeenDeleted()) break; @@ -504,7 +504,7 @@ bool ComponentPeer::handleKeyUpOrDown() { for (int i = target->keyListeners_->size(); --i >= 0;) { - keyWasUsed = ((KeyListener*) target->keyListeners_->getUnchecked(i))->keyStateChanged (target); + keyWasUsed = ((KeyListener*) target->keyListeners_->getUnchecked(i))->keyStateChanged (isKeyDown, target); if (keyWasUsed || deletionChecker.hasBeenDeleted()) return keyWasUsed; diff --git a/src/juce_appframework/gui/components/windows/juce_ComponentPeer.h b/src/juce_appframework/gui/components/windows/juce_ComponentPeer.h index 92f9ee5414..a2d9b23e85 100644 --- a/src/juce_appframework/gui/components/windows/juce_ComponentPeer.h +++ b/src/juce_appframework/gui/components/windows/juce_ComponentPeer.h @@ -281,7 +281,7 @@ public: /** Called whenever a key is pressed or released. Returns true if the keystroke was used. */ - bool handleKeyUpOrDown(); + bool handleKeyUpOrDown (const bool isKeyDown); /** Called whenever a modifier key is pressed or released. */ void handleModifierKeysChange(); diff --git a/src/juce_core/containers/juce_Variant.cpp b/src/juce_core/containers/juce_Variant.cpp index d4ff163aae..6070fe744a 100644 --- a/src/juce_core/containers/juce_Variant.cpp +++ b/src/juce_core/containers/juce_Variant.cpp @@ -264,7 +264,7 @@ const String var::toString() const throw() switch (type) { case voidType: - case objectType: return "Object 0x" + String::toHexString ((pointer_sized_int) value.objectValue); + case objectType: return "Object 0x" + String::toHexString ((int) (pointer_sized_int) value.objectValue); case intType: return String (value.intValue); case boolType: return value.boolValue ? T("1") : T("0"); case doubleType: return String (value.doubleValue); @@ -275,6 +275,11 @@ const String var::toString() const throw() return String::empty; } +var::operator const String() const throw() +{ + return toString(); +} + DynamicObject* var::getObject() const throw() { return type == objectType ? value.objectValue : 0; diff --git a/src/juce_core/containers/juce_Variant.h b/src/juce_core/containers/juce_Variant.h index 392b8d22dd..4714827f18 100644 --- a/src/juce_core/containers/juce_Variant.h +++ b/src/juce_core/containers/juce_Variant.h @@ -85,6 +85,7 @@ public: operator int() const throw(); operator bool() const throw(); operator double() const throw(); + operator const String() const throw(); const String toString() const throw(); DynamicObject* getObject() const throw();