mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-24 14:17:21 +01:00
Second round of Lua script API updates
This commit is contained in:
parent
1abf6a77d6
commit
76c0f42ecb
23 changed files with 76 additions and 112 deletions
|
|
@ -21,7 +21,6 @@ function factory () return function ()
|
|||
|
||||
local sel = Editor:get_selection () -- get current selection
|
||||
|
||||
local add_undo = false -- keep track of changes
|
||||
Session:begin_reversible_command ("Insert Gaps")
|
||||
|
||||
-- iterate over all selected tracks
|
||||
|
|
@ -40,23 +39,19 @@ function factory () return function ()
|
|||
region:to_stateful ():clear_changes ()
|
||||
|
||||
-- move region
|
||||
region:set_position (region:position() + offset, 0)
|
||||
region:set_position (region:position() + Temporal.timecnt_t (offset))
|
||||
offset = offset + Session:nominal_sample_rate () * gap
|
||||
|
||||
-- create a diff of the performed work, add it to the session's undo stack
|
||||
-- and check if it is not empty
|
||||
if not Session:add_stateful_diff_command (region:to_statefuldestructible ()):empty () then
|
||||
add_undo = true
|
||||
end
|
||||
Session:add_stateful_diff_command (region:to_statefuldestructible ())
|
||||
end
|
||||
::continue::
|
||||
end
|
||||
|
||||
-- all done, commit the combined Undo Operation
|
||||
if add_undo then
|
||||
-- the 'nil' Command here mean to use the collected diffs added above
|
||||
if not Session:abort_empty_reversible_command () then
|
||||
Session:commit_reversible_command (nil)
|
||||
else
|
||||
Session:abort_reversible_command ()
|
||||
end
|
||||
|
||||
end end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue