void IGraphics::OnMouseWheel(int x, int y, IMouseMod* pMod, int d) { int c = GetMouseControlIdx(x, y); if (c >= 0) { mControls.Get(c)->OnMouseWheel(x, y, pMod, d); } }
void IGraphics::OnFileDropped(const char* path, int x, int y) { int i = GetMouseControlIdx(x, y); IControl* control = GetControl(i); if (control != NULL) { control->OnFileDropped(path); } }
bool IGraphics::OnKeyDown(int x, int y, int key) { int c = GetMouseControlIdx(x, y); if (c > 0) return mControls.Get(c)->OnKeyDown(x, y, key); else if (mKeyCatcher) return mKeyCatcher->OnKeyDown(x, y, key); else return false; }
void IGraphics::OnMouseDown(int x, int y, IMouseMod* pMod) { ReleaseMouseCapture(); int c = GetMouseControlIdx(x, y); if (c >= 0) { mMouseCapture = c; mMouseX = x; mMouseY = y; IControl* pControl = mControls.Get(c); int paramIdx = pControl->ParamIdx(); #if defined OS_WIN || defined VST3_API // on Mac, IGraphics.cpp is not compiled in a static library, so this can be #ifdef'd if (mPlug->GetAPI() == kAPIVST3) { if (pMod->R && paramIdx >= 0) { ReleaseMouseCapture(); mPlug->PopupHostContextMenuForParam(paramIdx, x, y); return; } } #endif #ifdef AAX_API if (mAAXViewContainer && paramIdx >= 0) { uint32_t mods = GetAAXModifiersFromIMouseMod(pMod); #ifdef OS_WIN // required to get start/windows and alt keys uint32_t aaxViewMods = 0; mAAXViewContainer->GetModifiers(&aaxViewMods); mods |= aaxViewMods; #endif WDL_String paramID; paramID.SetFormatted(32, "%i", paramIdx+1); if (mAAXViewContainer->HandleParameterMouseDown(paramID.Get(), mods) == AAX_SUCCESS) { return; // event handled by PT } } #endif if (paramIdx >= 0) { mPlug->BeginInformHostOfParamChange(paramIdx); } pControl->OnMouseDown(x, y, pMod); } }
int IGraphics::GetParamIdxForPTAutomation(int x, int y) { int ctrl = GetMouseControlIdx(x, y, false); int idx = -1; if(ctrl) idx = mControls.Get(ctrl)->ParamIdx(); mLastClickedParam = idx; return idx; }
void IGraphics::OnMouseUp(int x, int y, IMouseMod* pMod) { int c = GetMouseControlIdx(x, y); mMouseCapture = mMouseX = mMouseY = -1; if (c >= 0) { IControl* pControl = mControls.Get(c); pControl->OnMouseUp(x, y, pMod); int paramIdx = pControl->ParamIdx(); if (paramIdx >= 0) { mPlug->EndInformHostOfParamChange(paramIdx); } } }
bool IGraphics::OnKeyDown(int x, int y, int key) { int c = GetMouseControlIdx(x, y); if (c > 0) { bool processedKey = mControls.Get(c)->OnKeyDown(x, y, key); if (!processedKey && mKeyCatcher) { return mKeyCatcher->OnKeyDown(x, y, key); } } else if (mKeyCatcher) return mKeyCatcher->OnKeyDown(x, y, key); else return false; }
void IGraphics::OnMouseUp(int x, int y, IMouseMod* pMod) { int c = GetMouseControlIdx(x, y); mMouseCapture = mMouseX = mMouseY = -1; if (c >= 0) { IControl* pControl = mControls.Get(c); pControl->OnMouseUp(x, y, pMod); pControl = mControls.Get(c); // needed if the mouse message caused a resize/rebuild int paramIdx = pControl->ParamIdx(); if ((paramIdx >= 0) && (paramIdx < mPlug->NParams())) { mPlug->EndInformHostOfParamChange(paramIdx); } } }
bool IGraphics::OnMouseOver(int x, int y, IMouseMod* pMod) { if (mHandleMouseOver) { int c = GetMouseControlIdx(x, y, true); if (c >= 0) { mMouseX = x; mMouseY = y; mControls.Get(c)->OnMouseOver(x, y, pMod); if (mMouseOver >= 0 && mMouseOver != c) { mControls.Get(mMouseOver)->OnMouseOut(); } mMouseOver = c; } } return mHandleMouseOver; }
void IGraphics::OnMouseDown(int x, int y, IMouseMod* pMod) { ReleaseMouseCapture(); int c = GetMouseControlIdx(x, y); if (c >= 0) { mMouseCapture = c; mMouseX = x; mMouseY = y; IControl* pControl = mControls.Get(c); pControl->OnMouseDown(x, y, pMod); int paramIdx = pControl->ParamIdx(); if (paramIdx >= 0) { mPlug->BeginInformHostOfParamChange(paramIdx); } } }
bool IGraphics::OnMouseDblClick(int x, int y, IMouseMod* pMod) { ReleaseMouseCapture(); bool newCapture = false; int c = GetMouseControlIdx(x, y); if (c >= 0) { IControl* pControl = mControls.Get(c); if (pControl->MouseDblAsSingleClick()) { mMouseCapture = c; mMouseX = x; mMouseY = y; pControl->OnMouseDown(x, y, pMod); newCapture = true; } else { pControl->OnMouseDblClick(x, y, pMod); } } return newCapture; }