Browse Source

changed the parameters to the keyStateChanged method, to sort out a problem with texteditor key interception that was otherwise impossible to fix. Made a couple of changes to the Mac NPAPI window positioning code; got rid of a couple of win32 warnings; added a couple of missing JUCE_API declarations; small fix to DragAndDropContainer; allowed var objects to be cast to a string.

tags/2021-05-28
jules 16 years ago
parent
commit
18533f9984
36 changed files with 247 additions and 160 deletions
  1. +2
    -2
      build/linux/platform_specific_code/juce_linux_Windowing.cpp
  2. +2
    -2
      build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm
  3. +1
    -1
      build/win32/platform_specific_code/juce_win32_Threads.cpp
  4. +4
    -4
      build/win32/platform_specific_code/juce_win32_Windowing.cpp
  5. +5
    -5
      extras/browser plugins/demo/build/mac/JuceBrowserPluginDemo.xcodeproj/project.pbxproj
  6. +2
    -2
      extras/browser plugins/wrapper/juce_ActiveX_GlueCode.cpp
  7. +47
    -14
      extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp
  8. +38
    -38
      extras/browser plugins/wrapper/juce_NPAPI_GlueCode.mm
  9. +1
    -1
      extras/the jucer/src/model/jucer_JucerDocument.cpp
  10. +52
    -37
      juce_amalgamated.cpp
  11. +25
    -13
      juce_amalgamated.h
  12. +1
    -1
      src/juce_appframework/audio/plugins/formats/juce_AudioUnitPluginFormat.mm
  13. +1
    -1
      src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp
  14. +3
    -3
      src/juce_appframework/audio/processors/juce_AudioProcessorGraph.h
  15. +1
    -1
      src/juce_appframework/gui/components/buttons/juce_Button.cpp
  16. +1
    -1
      src/juce_appframework/gui/components/buttons/juce_Button.h
  17. +6
    -5
      src/juce_appframework/gui/components/controls/juce_ComboBox.cpp
  18. +1
    -1
      src/juce_appframework/gui/components/controls/juce_ComboBox.h
  19. +10
    -9
      src/juce_appframework/gui/components/controls/juce_ListBox.cpp
  20. +1
    -1
      src/juce_appframework/gui/components/controls/juce_ListBox.h
  21. +9
    -1
      src/juce_appframework/gui/components/controls/juce_TextEditor.cpp
  22. +1
    -1
      src/juce_appframework/gui/components/controls/juce_TextEditor.h
  23. +1
    -1
      src/juce_appframework/gui/components/juce_Component.cpp
  24. +7
    -1
      src/juce_appframework/gui/components/juce_Component.h
  25. +1
    -1
      src/juce_appframework/gui/components/keyboard/juce_KeyListener.cpp
  26. +6
    -1
      src/juce_appframework/gui/components/keyboard/juce_KeyListener.h
  27. +1
    -1
      src/juce_appframework/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp
  28. +2
    -2
      src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.cpp
  29. +1
    -1
      src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.h
  30. +1
    -1
      src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp
  31. +1
    -1
      src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.cpp
  32. +1
    -1
      src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.h
  33. +3
    -3
      src/juce_appframework/gui/components/windows/juce_ComponentPeer.cpp
  34. +1
    -1
      src/juce_appframework/gui/components/windows/juce_ComponentPeer.h
  35. +6
    -1
      src/juce_core/containers/juce_Variant.cpp
  36. +1
    -0
      src/juce_core/containers/juce_Variant.h

+ 2
- 2
build/linux/platform_specific_code/juce_linux_Windowing.cpp View File

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


+ 2
- 2
build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm View File

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


+ 1
- 1
build/win32/platform_specific_code/juce_win32_Threads.cpp View File

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


+ 4
- 4
build/win32/platform_specific_code/juce_win32_Windowing.cpp View File

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


+ 5
- 5
extras/browser plugins/demo/build/mac/JuceBrowserPluginDemo.xcodeproj/project.pbxproj View File

@@ -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 = "<absolute>"; };
842CC8E00FA5D26A008C7970 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
842CC8E10FA5D26A008C7970 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
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 = "<group>"; };
/* End PBXFileReference section */
@@ -168,7 +168,7 @@
842CC9370FA5D51F008C7970 /* Products */ = {
isa = PBXGroup;
children = (
842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.bundle */,
842CC9360FA5D51F008C7970 /* JuceBrowserPluginDemo.plugin */,
);
name = Products;
sourceTree = "<group>";
@@ -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 */


+ 2
- 2
extras/browser plugins/wrapper/juce_ActiveX_GlueCode.cpp View File

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


+ 47
- 14
extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp View File

@@ -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;
if (x >= 0 && x < r.size.width && y >= 0 && y < r.size.height)
NSRect frame = [parent frame];
NSRect bounds = [parent bounds];
x -= frame.origin.x;
y -= frame.origin.y;
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));
// 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());
if (! isBrowserContentView (parentView))
parentView = currentParentView;
// 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
}
};


+ 38
- 38
extras/browser plugins/wrapper/juce_NPAPI_GlueCode.mm View File

@@ -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 <Cocoa/Cocoa.h>
#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 <Cocoa/Cocoa.h>
#define JUCE_NPAPI_WRAPPED_IN_MM 1
#include "juce_NPAPI_GlueCode.cpp"

+ 1
- 1
extras/the jucer/src/model/jucer_JucerDocument.cpp View File

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


+ 52
- 37
juce_amalgamated.cpp View File

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


+ 25
- 13
juce_amalgamated.h View File

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


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

@@ -1004,7 +1004,7 @@ public:
}
//==============================================================================
bool keyStateChanged()
bool keyStateChanged (const bool)
{
return false;
}


+ 1
- 1
src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp View File

@@ -1269,7 +1269,7 @@ public:
#endif
//==============================================================================
bool keyStateChanged()
bool keyStateChanged (const bool)
{
return pluginWantsKeys;
}


+ 3
- 3
src/juce_appframework/audio/processors/juce_AudioProcessorGraph.h View File

@@ -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.


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

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


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

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


+ 6
- 5
src/juce_appframework/gui/components/controls/juce_ComboBox.cpp View File

@@ -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));
}
//==============================================================================


+ 1
- 1
src/juce_appframework/gui/components/controls/juce_ComboBox.h View File

@@ -360,7 +360,7 @@ public:
/** @internal */
void resized();
/** @internal */
bool keyStateChanged();
bool keyStateChanged (const bool isKeyDown);
/** @internal */
bool keyPressed (const KeyPress&);


+ 10
- 9
src/juce_appframework/gui/components/controls/juce_ListBox.cpp View File

@@ -791,15 +791,16 @@ bool ListBox::keyPressed (const KeyPress& key)
return true;
}
bool ListBox::keyStateChanged()
{
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);
bool ListBox::keyStateChanged (const bool isKeyDown)
{
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)


+ 1
- 1
src/juce_appframework/gui/components/controls/juce_ListBox.h View File

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


+ 9
- 1
src/juce_appframework/gui/components/controls/juce_TextEditor.cpp View File

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


+ 1
- 1
src/juce_appframework/gui/components/controls/juce_TextEditor.h View File

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


+ 1
- 1
src/juce_appframework/gui/components/juce_Component.cpp View File

@@ -3534,7 +3534,7 @@ bool Component::keyPressed (const KeyPress&)
return false;
}
bool Component::keyStateChanged()
bool Component::keyStateChanged (const bool /*isKeyDown*/)
{
return false;
}


+ 7
- 1
src/juce_appframework/gui/components/juce_Component.h View File

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


+ 1
- 1
src/juce_appframework/gui/components/keyboard/juce_KeyListener.cpp View File

@@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
bool KeyListener::keyStateChanged (Component*)
bool KeyListener::keyStateChanged (const bool, Component*)
{
return false;
}


+ 6
- 1
src/juce_appframework/gui/components/keyboard/juce_KeyListener.h View File

@@ -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*) {};
};


+ 1
- 1
src/juce_appframework/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp View File

@@ -494,7 +494,7 @@ public:
return true;
}
bool keyStateChanged()
bool keyStateChanged (const bool)
{
return true;
}


+ 2
- 2
src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.cpp View File

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


+ 1
- 1
src/juce_appframework/gui/components/keyboard/juce_KeyPressMappingSet.h View File

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


+ 1
- 1
src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp View File

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


+ 1
- 1
src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.cpp View File

@@ -836,7 +836,7 @@ void MidiKeyboardComponent::setKeyPressBaseOctave (const int newOctaveNumber)
keyMappingOctave = newOctaveNumber;
}
bool MidiKeyboardComponent::keyStateChanged()
bool MidiKeyboardComponent::keyStateChanged (const bool /*isKeyDown*/)
{
bool keyPressUsed = false;


+ 1
- 1
src/juce_appframework/gui/components/special/juce_MidiKeyboardComponent.h View File

@@ -298,7 +298,7 @@ public:
/** @internal */
void timerCallback();
/** @internal */
bool keyStateChanged();
bool keyStateChanged (const bool isKeyDown);
/** @internal */
void focusLost (FocusChangeType cause);
/** @internal */


+ 3
- 3
src/juce_appframework/gui/components/windows/juce_ComponentPeer.cpp View File

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


+ 1
- 1
src/juce_appframework/gui/components/windows/juce_ComponentPeer.h View File

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


+ 6
- 1
src/juce_core/containers/juce_Variant.cpp View File

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


+ 1
- 0
src/juce_core/containers/juce_Variant.h View File

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


Loading…
Cancel
Save