2017-02-23 16:31:03 -05:00
|
|
|
ardour {
|
|
|
|
["type"] = "EditorAction",
|
|
|
|
name = "Region Select/2",
|
|
|
|
license = "MIT",
|
|
|
|
author = "Ardour Team",
|
|
|
|
description = [[select every 2nd region on all selected tracks]]
|
|
|
|
}
|
|
|
|
|
|
|
|
-- select every 2nd region on all selected tracks
|
|
|
|
function factory () return function ()
|
|
|
|
|
|
|
|
local sl = ArdourUI.SelectionList () -- empty selection list
|
|
|
|
|
|
|
|
local sel = Editor:get_selection () -- get current selection
|
|
|
|
-- for each selected track/bus..
|
|
|
|
for route in sel.tracks:routelist ():iter () do
|
|
|
|
-- consider only tracks
|
|
|
|
local track = route:to_track ()
|
|
|
|
if track:isnil() then
|
|
|
|
goto continue
|
|
|
|
end
|
|
|
|
|
|
|
|
local skip = false;
|
|
|
|
-- iterate over all regions of the given track
|
|
|
|
for region in track:playlist():region_list():iter() do
|
|
|
|
if skip then
|
|
|
|
-- skip every 2nd region
|
|
|
|
skip = false;
|
|
|
|
else
|
|
|
|
skip = true;
|
|
|
|
-- get RegionView (GUI object to be selected)
|
2017-02-24 07:03:24 -05:00
|
|
|
local rv = Editor:regionview_from_region (region)
|
2017-02-23 16:31:03 -05:00
|
|
|
-- add it to the list of Objects to be selected
|
|
|
|
sl:push_back (rv);
|
|
|
|
end
|
|
|
|
end
|
|
|
|
::continue::
|
|
|
|
end
|
|
|
|
|
|
|
|
-- set/replace current selection in the editor
|
|
|
|
Editor:set_selection (sl, ArdourUI.SelectionOp.Set);
|
|
|
|
end end
|