Compare commits
No commits in common. "b3593bd713a44f593465d665899b861799536870" and "f1e44c6acf77cdf44eed75575fe07d52d62a91f9" have entirely different histories.
b3593bd713
...
f1e44c6acf
163
.editorconfig
163
.editorconfig
|
@ -1,163 +0,0 @@
|
||||||
# see https://github.com/CppCXY/EmmyLuaCodeStyle
|
|
||||||
[*.lua]
|
|
||||||
# [basic]
|
|
||||||
|
|
||||||
# optional space/tab
|
|
||||||
indent_style = space
|
|
||||||
# if indent_style is space, this is valid
|
|
||||||
indent_size = 4
|
|
||||||
# if indent_style is tab, this is valid
|
|
||||||
tab_width = 4
|
|
||||||
# none/single/double
|
|
||||||
quote_style = none
|
|
||||||
|
|
||||||
continuation_indent = 4
|
|
||||||
## extend option
|
|
||||||
# continuation_indent.before_block = 4
|
|
||||||
# continuation_indent.in_expr = 4
|
|
||||||
# continuation_indent.in_table = 4
|
|
||||||
|
|
||||||
# this mean utf8 length , if this is 'unset' then the line width is no longer checked
|
|
||||||
# this option decides when to chopdown the code
|
|
||||||
max_line_length = 100
|
|
||||||
|
|
||||||
# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
|
|
||||||
# in neovim the value 'auto' is not a valid option, please use 'unset'
|
|
||||||
end_of_line = lf
|
|
||||||
|
|
||||||
# none/comma/semicolon/only_kv_colon
|
|
||||||
table_separator_style = none
|
|
||||||
|
|
||||||
#optional keep/never/always/smart
|
|
||||||
trailing_table_separator = keep
|
|
||||||
|
|
||||||
# keep/remove/remove_table_only/remove_string_only
|
|
||||||
call_arg_parentheses = keep
|
|
||||||
|
|
||||||
detect_end_of_line = false
|
|
||||||
|
|
||||||
# this will check text end with new line
|
|
||||||
insert_final_newline = true
|
|
||||||
|
|
||||||
# [space]
|
|
||||||
space_around_table_field_list = true
|
|
||||||
|
|
||||||
space_before_attribute = true
|
|
||||||
|
|
||||||
space_before_function_open_parenthesis = false
|
|
||||||
|
|
||||||
space_before_function_call_open_parenthesis = false
|
|
||||||
|
|
||||||
space_before_closure_open_parenthesis = true
|
|
||||||
|
|
||||||
# optional always/only_string/only_table/none
|
|
||||||
# or true/false
|
|
||||||
space_before_function_call_single_arg = always
|
|
||||||
## extend option
|
|
||||||
## always/keep/none
|
|
||||||
# space_before_function_call_single_arg.table = always
|
|
||||||
## always/keep/none
|
|
||||||
# space_before_function_call_single_arg.string = always
|
|
||||||
|
|
||||||
space_before_open_square_bracket = false
|
|
||||||
|
|
||||||
space_inside_function_call_parentheses = false
|
|
||||||
|
|
||||||
space_inside_function_param_list_parentheses = false
|
|
||||||
|
|
||||||
space_inside_square_brackets = false
|
|
||||||
|
|
||||||
# like t[#t+1] = 1
|
|
||||||
space_around_table_append_operator = false
|
|
||||||
|
|
||||||
ignore_spaces_inside_function_call = false
|
|
||||||
|
|
||||||
# detail number or 'keep'
|
|
||||||
space_before_inline_comment = 1
|
|
||||||
|
|
||||||
# [operator space]
|
|
||||||
space_around_math_operator = true
|
|
||||||
|
|
||||||
space_after_comma = true
|
|
||||||
|
|
||||||
space_after_comma_in_for_statement = true
|
|
||||||
|
|
||||||
# true/false or none/always/no_space_asym
|
|
||||||
space_around_concat_operator = true
|
|
||||||
|
|
||||||
space_around_logical_operator = true
|
|
||||||
|
|
||||||
# true/false or none/always/no_space_asym
|
|
||||||
space_around_assign_operator = true
|
|
||||||
|
|
||||||
# [align]
|
|
||||||
|
|
||||||
align_call_args = false
|
|
||||||
|
|
||||||
align_function_params = true
|
|
||||||
|
|
||||||
align_continuous_assign_statement = true
|
|
||||||
|
|
||||||
align_continuous_rect_table_field = true
|
|
||||||
|
|
||||||
align_continuous_line_space = 2
|
|
||||||
|
|
||||||
align_if_branch = false
|
|
||||||
|
|
||||||
# option none / always / contain_curly/
|
|
||||||
align_array_table = true
|
|
||||||
|
|
||||||
align_continuous_similar_call_args = false
|
|
||||||
|
|
||||||
align_continuous_inline_comment = true
|
|
||||||
# option none / always / only_call_stmt
|
|
||||||
align_chain_expr = none
|
|
||||||
|
|
||||||
# [indent]
|
|
||||||
|
|
||||||
never_indent_before_if_condition = false
|
|
||||||
|
|
||||||
never_indent_comment_on_if_branch = false
|
|
||||||
|
|
||||||
keep_indents_on_empty_lines = false
|
|
||||||
# [line space]
|
|
||||||
|
|
||||||
# The following configuration supports four expressions
|
|
||||||
# keep
|
|
||||||
# fixed(n)
|
|
||||||
# min(n)
|
|
||||||
# max(n)
|
|
||||||
# for eg. min(2)
|
|
||||||
|
|
||||||
line_space_after_if_statement = keep
|
|
||||||
|
|
||||||
line_space_after_do_statement = keep
|
|
||||||
|
|
||||||
line_space_after_while_statement = keep
|
|
||||||
|
|
||||||
line_space_after_repeat_statement = keep
|
|
||||||
|
|
||||||
line_space_after_for_statement = keep
|
|
||||||
|
|
||||||
line_space_after_local_or_assign_statement = keep
|
|
||||||
|
|
||||||
line_space_after_function_statement = fixed(2)
|
|
||||||
|
|
||||||
line_space_after_expression_statement = keep
|
|
||||||
|
|
||||||
line_space_after_comment = keep
|
|
||||||
|
|
||||||
line_space_around_block = fixed(1)
|
|
||||||
# [line break]
|
|
||||||
break_all_list_when_line_exceed = false
|
|
||||||
|
|
||||||
auto_collapse_lines = false
|
|
||||||
|
|
||||||
break_before_braces = false
|
|
||||||
|
|
||||||
# [preference]
|
|
||||||
ignore_space_after_colon = false
|
|
||||||
|
|
||||||
remove_call_expression_list_finish_comma = false
|
|
||||||
# keep / always / same_line / replace_with_newline / never
|
|
||||||
end_statement_with_semicolon = same_line
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"Lua.runtime.version": "Lua 5.3",
|
|
||||||
"Lua.diagnostics.globals": [
|
|
||||||
"ardour",
|
|
||||||
"factory",
|
|
||||||
"icon",
|
|
||||||
"sess_params",
|
|
||||||
"signals"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,143 +0,0 @@
|
||||||
---@meta
|
|
||||||
|
|
||||||
---@class ID
|
|
||||||
ID = {}
|
|
||||||
|
|
||||||
---@return string
|
|
||||||
function ID:to_s() end
|
|
||||||
|
|
||||||
---@class StatefulDestructible
|
|
||||||
StatefulDestructible = {}
|
|
||||||
|
|
||||||
---@class StatefulDestructiblePtr
|
|
||||||
StatefulDestructiblePtr = {}
|
|
||||||
|
|
||||||
function StatefulDestructiblePtr:clear_changes() end
|
|
||||||
|
|
||||||
---@class SessionObjectPtr
|
|
||||||
SessionObjectPtr = {}
|
|
||||||
|
|
||||||
---@return StatefulDestructible
|
|
||||||
function SessionObjectPtr:to_statefuldestructible() end
|
|
||||||
|
|
||||||
---@return ID
|
|
||||||
function StatefulDestructiblePtr:id() end
|
|
||||||
|
|
||||||
---@class Temporal
|
|
||||||
Temporal = {}
|
|
||||||
|
|
||||||
---@param pos integer
|
|
||||||
---@return timepos_t
|
|
||||||
function Temporal.timepos_t(pos) end
|
|
||||||
|
|
||||||
---@param pos integer
|
|
||||||
---@return timecnt_t
|
|
||||||
function Temporal.timecnt_t(pos) end
|
|
||||||
|
|
||||||
---@class timepos_t
|
|
||||||
timepos_t = {}
|
|
||||||
|
|
||||||
---@class timecnt_t
|
|
||||||
timecnt_t = {}
|
|
||||||
|
|
||||||
---@class Location
|
|
||||||
Location = {}
|
|
||||||
|
|
||||||
---@return string
|
|
||||||
function Location:name() end
|
|
||||||
|
|
||||||
---@class Locations
|
|
||||||
Locations = {}
|
|
||||||
|
|
||||||
---@param pos timepos_t
|
|
||||||
---@param cnt timecnt_t
|
|
||||||
---@param flag boolean
|
|
||||||
---@return Location
|
|
||||||
function Locations:range_starts_at(pos, cnt, flag) end
|
|
||||||
|
|
||||||
---@class Route
|
|
||||||
Route = {}
|
|
||||||
|
|
||||||
---@return Track
|
|
||||||
function Route:to_track() end
|
|
||||||
|
|
||||||
---@class RouteListPtr
|
|
||||||
RouteListPtr = {}
|
|
||||||
|
|
||||||
---@return fun():Route
|
|
||||||
function RouteListPtr:iter() end
|
|
||||||
|
|
||||||
---@class Region: SessionObjectPtr
|
|
||||||
Region = {}
|
|
||||||
|
|
||||||
---@return boolean
|
|
||||||
function Region:isnil() end
|
|
||||||
---@return timepos_t
|
|
||||||
function Region:position() end
|
|
||||||
---@param string name
|
|
||||||
function Region:set_name(name) end
|
|
||||||
---@return AudioRegion
|
|
||||||
function Region:to_audioregion() end
|
|
||||||
---@return StatefulDestructiblePtr
|
|
||||||
function Region:to_stateful() end
|
|
||||||
|
|
||||||
---@class RegionList
|
|
||||||
RegionList = {}
|
|
||||||
|
|
||||||
---@return fun():Region
|
|
||||||
function RegionList:iter() end
|
|
||||||
|
|
||||||
---@class RegionSelection
|
|
||||||
RegionSelection = {}
|
|
||||||
|
|
||||||
---@return RegionList
|
|
||||||
function RegionSelection:regionlist() end
|
|
||||||
|
|
||||||
---@class AudioRegion: Region
|
|
||||||
AudioRegion = {}
|
|
||||||
|
|
||||||
---@return boolean
|
|
||||||
function AudioRegion:isnil() end
|
|
||||||
|
|
||||||
---@class Playlist
|
|
||||||
Playlist = {}
|
|
||||||
|
|
||||||
---@param region_id ID
|
|
||||||
---@return Region
|
|
||||||
function Playlist:region_by_id(region_id) end
|
|
||||||
|
|
||||||
---@class Track
|
|
||||||
Track = {}
|
|
||||||
|
|
||||||
---@return Playlist
|
|
||||||
function Track:playlist() end
|
|
||||||
---@return string
|
|
||||||
function Track:name() end
|
|
||||||
|
|
||||||
---@class Command
|
|
||||||
Command = {}
|
|
||||||
|
|
||||||
---@class Selection
|
|
||||||
---@field regions RegionSelection
|
|
||||||
Selection = {}
|
|
||||||
|
|
||||||
---@class Session
|
|
||||||
Session = {}
|
|
||||||
|
|
||||||
---@return Locations
|
|
||||||
function Session:locations() end
|
|
||||||
---@return RouteListPtr
|
|
||||||
function Session:get_tracks() end
|
|
||||||
---@param name string
|
|
||||||
function Session:begin_reversible_command(name) end
|
|
||||||
---@param obj StatefulDestructible|StatefulDestructiblePtr
|
|
||||||
function Session:add_stateful_diff_command(obj) end
|
|
||||||
function Session:abort_empty_reversible_command() end
|
|
||||||
---@param cmd Command|nil
|
|
||||||
function Session:commit_reversible_command(cmd?) end
|
|
||||||
|
|
||||||
---@class Editor
|
|
||||||
Editor = {}
|
|
||||||
|
|
||||||
---@return Selection
|
|
||||||
function Editor:get_selection() end
|
|
|
@ -9,30 +9,29 @@ ardour {
|
||||||
function factory()
|
function factory()
|
||||||
-- there is currently no direct way to find the track
|
-- there is currently no direct way to find the track
|
||||||
-- corresponding to a [selected] region
|
-- corresponding to a [selected] region
|
||||||
---@param region_id ID
|
function find_track_for_region(region_id)
|
||||||
---@return Track?
|
|
||||||
local function find_track_for_region(region_id)
|
|
||||||
for route in Session:get_tracks():iter() do
|
for route in Session:get_tracks():iter() do
|
||||||
local track = route:to_track()
|
local track = route:to_track();
|
||||||
local pl = track:playlist()
|
local pl = track:playlist ()
|
||||||
if not pl:region_by_id(region_id):isnil() then
|
if not pl:region_by_id(region_id):isnil() then
|
||||||
return track
|
return track
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert(0) -- can't happen, region must be in a playlist
|
assert (0) -- can't happen, region must be in a playlist
|
||||||
end
|
end
|
||||||
|
|
||||||
return function ()
|
return function()
|
||||||
local sel = Editor:get_selection() -- get current selection
|
local sel = Editor:get_selection () -- get current selection
|
||||||
local loc = Session:locations() -- get locations
|
local loc = Session:locations() -- get locations
|
||||||
|
|
||||||
-- prepare undo operation
|
-- prepare undo operation
|
||||||
Session:begin_reversible_command("Rename regions from markers")
|
Session:begin_reversible_command ("Rename regions from markers")
|
||||||
|
|
||||||
-- for each selected region...
|
-- for each selected region...
|
||||||
for region in sel.regions:regionlist():iter() do
|
for region in sel.regions:regionlist():iter () do
|
||||||
-- test if it's an audio region
|
-- test if it's an audio region
|
||||||
if region:to_audioregion():isnil() then
|
local ar = region:to_audioregion ()
|
||||||
|
if ar:isnil() then
|
||||||
goto next
|
goto next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,16 +48,14 @@ function factory()
|
||||||
|
|
||||||
local track = find_track_for_region(rid)
|
local track = find_track_for_region(rid)
|
||||||
|
|
||||||
if track then
|
region:to_stateful():clear_changes()
|
||||||
region:to_stateful():clear_changes()
|
|
||||||
|
|
||||||
--~ print("Marker label:", mloc:name())
|
--~ print("Marker label:", mloc:name())
|
||||||
-- rename region to track name + marker label
|
-- rename region to track name + marker label
|
||||||
region:set_name(track:name() .. " " .. mloc:name())
|
region:set_name(track:name() .. " " .. mloc:name())
|
||||||
|
|
||||||
-- collect undo data
|
-- collect undo data
|
||||||
Session:add_stateful_diff_command(region:to_statefuldestructible())
|
Session:add_stateful_diff_command(region:to_statefuldestructible())
|
||||||
end
|
|
||||||
|
|
||||||
::next::
|
::next::
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue