2 ["type"] = "EditorAction",
3 name = "Region Select/2",
5 author = "Ardour Team",
6 description = [[select every 2nd region on all selected tracks]]
9 -- select every 2nd region on all selected tracks
10 function factory () return function ()
12 local sl = ArdourUI.SelectionList () -- empty selection list
14 local sel = Editor:get_selection () -- get current selection
15 -- for each selected track/bus..
16 for route in sel.tracks:routelist ():iter () do
17 -- consider only tracks
18 local track = route:to_track ()
24 -- iterate over all regions of the given track
25 for region in track:playlist():region_list():iter() do
27 -- skip every 2nd region
31 -- get RegionView (GUI object to be selected)
32 local rv = Editor:regionview_from_region (region)
33 -- add it to the list of Objects to be selected
40 -- set/replace current selection in the editor
41 Editor:set_selection (sl, ArdourUI.SelectionOp.Set);
44 function icon (params) return function (ctx, width, height, fg)
45 local wh = math.min (width, height) * .5
47 ctx:set_line_width (1)
48 ctx:rectangle (wh * .25, wh * .75, wh * 1.5 , .5 * wh)
49 ctx:set_source_rgba (0, 0, 0, 1)
50 ctx:stroke_preserve ()
51 ctx:set_source_rgba (.9, .9, .9, 1)
54 ctx:set_source_rgba (1, 0, 0, 1)
55 ctx:rectangle (.5 + math.ceil(wh * 0.25), .5 + math.ceil(wh * .75), math.floor(wh * .5) - 1, math.floor(.5 * wh) - 1)
56 ctx:stroke_preserve ()
58 ctx:rectangle (.5 + math.ceil(wh * 1.25), .5 + math.ceil(wh * .75), math.floor(wh * .5) - 1, math.floor(.5 * wh) - 1)
59 ctx:stroke_preserve ()