forked from ReaTeam/ReaScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create amagalma_Fit vertically all tracks into view (if possible).lua (…
…ReaTeam#140) * Create amagalma_Fit vertically all tracks into view (if possible).lua * Update amagalma_Smart contextual zoom.lua
- Loading branch information
Showing
2 changed files
with
189 additions
and
56 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
Tracks Properties/amagalma_Fit vertically all tracks into view (if possible).lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- @description amagalma_Fit vertically all tracks into view (if possible) | ||
-- @author amagalma | ||
-- @version 1.0 | ||
-- @about | ||
-- # Zooms vertically to fit all tracks into view (if possible) | ||
-- # No undo point creation | ||
|
||
local reaper = reaper | ||
|
||
-- Save non selected tracks | ||
local unsel_tr = {} | ||
local c = 0 | ||
local tr_cnt = reaper.CSurf_NumTracks( false ) | ||
for i = 0, tr_cnt do | ||
local track = reaper.CSurf_TrackFromID( i, false ) | ||
if not reaper.IsTrackSelected( track ) then | ||
c = c + 1 | ||
unsel_tr[c] = track | ||
end | ||
end | ||
reaper.PreventUIRefresh( 1 ) | ||
-- select all tracks (unselected ones) | ||
for i = 1, #unsel_tr do | ||
reaper.SetTrackSelected( unsel_tr[i], true ) | ||
end | ||
-- SWS: Vertical zoom to selected tracks | ||
reaper.Main_OnCommand(reaper.NamedCommandLookup('_SWS_VZOOMFIT'), 0) | ||
-- Restore initial track selection | ||
for i = 1, #unsel_tr do | ||
reaper.SetTrackSelected( unsel_tr[i], false ) | ||
end | ||
reaper.PreventUIRefresh( -1 ) | ||
reaper.defer(function() end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters