Skip to content

Commit a4639c7

Browse files
authored
Release Scroll the arrange view to the top of the track lane or envelope under the mouse cursor v1.00 (#1684)
1 parent 9d677db commit a4639c7

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
-- @description Scroll the arrange view to the top of the track lane or envelope under the mouse cursor
2+
-- @author amagalma
3+
-- @version 1.00
4+
-- @donation https://www.paypal.me/amagalma
5+
6+
if not reaper.CF_SetTcpScroll then
7+
return reaper.MB( "Please, install / update SWS.", "Missing CF_SetTcpScroll API", 0 )
8+
end
9+
10+
local x, y = reaper.GetMousePosition()
11+
local track, info = reaper.GetTrackFromPoint( x, y )
12+
13+
if not track then return end
14+
15+
local function Info( str )
16+
return reaper.GetMediaTrackInfo_Value( track, str )
17+
end
18+
19+
local position = 0
20+
21+
if info == 1 then
22+
reaper.BR_GetMouseCursorContext()
23+
local env, isTakeEnvelope = reaper.BR_GetMouseCursorContext_Envelope()
24+
if not isTakeEnvelope then
25+
position = reaper.GetEnvelopeInfo_Value( env, "I_TCPY_USED" )
26+
end
27+
else
28+
local lane = info >> 8
29+
if lane > 0 and Info("C_LANESCOLLAPSED") == 0 then
30+
position = ( ( Info("I_TCPH") - 18 )/ Info("I_NUMFIXEDLANES") ) * lane - 1
31+
end
32+
end
33+
34+
reaper.CF_SetTcpScroll( track, position )

0 commit comments

Comments
 (0)