Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-- @description Scroll the arrange view to the top of the track lane or envelope under the mouse cursor
-- @author amagalma
-- @version 1.00
-- @donation https://www.paypal.me/amagalma

if not reaper.CF_SetTcpScroll then
return reaper.MB( "Please, install / update SWS.", "Missing CF_SetTcpScroll API", 0 )
end

local x, y = reaper.GetMousePosition()
local track, info = reaper.GetTrackFromPoint( x, y )

if not track then return end

local function Info( str )
return reaper.GetMediaTrackInfo_Value( track, str )
end

local position = 0

if info == 1 then
reaper.BR_GetMouseCursorContext()
local env, isTakeEnvelope = reaper.BR_GetMouseCursorContext_Envelope()
if not isTakeEnvelope then
position = reaper.GetEnvelopeInfo_Value( env, "I_TCPY_USED" )
end
else
local lane = info >> 8
if lane > 0 and Info("C_LANESCOLLAPSED") == 0 then
position = ( ( Info("I_TCPH") - 18 )/ Info("I_NUMFIXEDLANES") ) * lane - 1
end
end

reaper.CF_SetTcpScroll( track, position )