Skip to content

Commit

Permalink
Fixes for IGNORE_MOUSE_WITH_PRO_TOOLS_AUTOMATION_MODIFIERS to not loc…
Browse files Browse the repository at this point in the history
…k parameters on sliders.
  • Loading branch information
talaviram committed Dec 2, 2019
1 parent 84a911d commit 04f8c74
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
Expand Up @@ -363,12 +363,20 @@ struct AttachedControlBase : public AudioProcessorValueTreeState::Listener,

void beginParameterChange()
{
#ifdef IGNORE_MOUSE_WITH_PRO_TOOLS_AUTOMATION_MODIFIERS
if (Component::wasProToolsModifiersDown())
return;
#endif
if (AudioProcessorParameter* p = state.getParameter (paramID))
p->beginChangeGesture();
}

void endParameterChange()
{
#ifdef IGNORE_MOUSE_WITH_PRO_TOOLS_AUTOMATION_MODIFIERS
if (Component::wasProToolsModifiersDown())
return;
#endif
if (AudioProcessorParameter* p = state.getParameter (paramID))
p->endChangeGesture();
}
Expand Down
20 changes: 16 additions & 4 deletions modules/juce_gui_basics/components/juce_Component.cpp
Expand Up @@ -2440,8 +2440,20 @@ void Component::internalMouseExit (MouseInputSource source, Point<float> relativ
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me);
}

#ifdef IGNORE_MOUSE_WITH_PRO_TOOLS_AUTOMATION_MODIFIERS
static bool wasProToolsModifiersDownState = false;
bool JUCE_CALLTYPE Component::wasProToolsModifiersDown() noexcept
{
return wasProToolsModifiersDownState;
}
#endif

void Component::internalMouseDown (MouseInputSource source, Point<float> relativePos, Time time, float pressure)
{
#ifdef IGNORE_MOUSE_WITH_PRO_TOOLS_AUTOMATION_MODIFIERS
const auto curModifiers = ModifierKeys::getCurrentModifiers();
wasProToolsModifiersDownState = curModifiers.isCommandDown() && curModifiers.isCtrlDown();
#endif
Desktop& desktop = Desktop::getInstance();
BailOutChecker checker (this);

Expand Down Expand Up @@ -2508,11 +2520,11 @@ void Component::internalMouseUp (MouseInputSource source, Point<float> relativeP
Time time, const ModifierKeys oldModifiers, float pressure)
{
#ifdef IGNORE_MOUSE_WITH_PRO_TOOLS_AUTOMATION_MODIFIERS
// Under Pro Tools,
// Cmd+Ctrl+Click switch automation lane if component is enabled for automation
// Cmd+Ctrl+Alt+Click opens dialog for Enable/Disable automation of component.
if (oldModifiers.isCommandDown() && oldModifiers.isCtrlDown())
if (wasProToolsModifiersDown())
{
wasProToolsModifiersDownState = false;
return;
}
#endif

if (flags.mouseDownWasBlocked && isCurrentlyBlockedByAnotherModalComponent())
Expand Down
7 changes: 7 additions & 0 deletions modules/juce_gui_basics/components/juce_Component.h
Expand Up @@ -1783,6 +1783,13 @@ class JUCE_API Component : public MouseListener
*/
Point<int> getMouseXYRelative() const;

#ifdef IGNORE_MOUSE_WITH_PRO_TOOLS_AUTOMATION_MODIFIERS
// Under Pro Tools,
// Cmd+Ctrl+Click switch automation lane if component is enabled for automation
// Cmd+Ctrl+Alt+Click opens dialog for Enable/Disable automation of component.
static bool JUCE_CALLTYPE wasProToolsModifiersDown() noexcept;
#endif

//==============================================================================
/** Called when this component's size has been changed.
Expand Down

0 comments on commit 04f8c74

Please sign in to comment.