Skip to content

Commit ee890e4

Browse files
committed
Update expression_playback.lua
Added visual confirmation of the "special" layers, 0, 5 and 6. (Radio button now zero-based index).
1 parent 9c5b59b commit ee890e4

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/expression_playback.lua

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ function plugindef()
33
finaleplugin.Author = "Carl Vine"
44
finaleplugin.AuthorURL = "http://carlvine.com/lua/"
55
finaleplugin.Copyright = "https://creativecommons.org/licenses/by/4.0/"
6-
finaleplugin.Version = "0.07"
7-
finaleplugin.Date = "2024/07/27"
6+
finaleplugin.Version = "0.08"
7+
finaleplugin.Date = "2024/07/28"
88
finaleplugin.Notes = [[
99
Change the assigned playback layer and position for all expressions
1010
in the current selection.
11-
Layers __1-4__ are the _standard_ playback layers.
11+
Layers __1__-__4__ are the _standard_ playback layers.
1212
Layer numbers __0__, __5__ and __6__ are interpreted respectively
1313
as __Current__, __Chord__ and __Expression__ Layers for playback.
1414
@@ -30,9 +30,14 @@ local start_options = { -- "Begin Playback At:" (ordered)
3030
finale.EXPRPLAYSTART_POSINMEASURE
3131
}
3232
}
33+
local special_layer = {
34+
[0] = "(\"Current\" Layer)",
35+
[5] = "(Chord Layer)",
36+
[6] = "(Expression Layer)",
37+
}
3338
local c = { -- user config values
3439
layer = 0,
35-
start_at = 1, -- {start_options} chosen index (1-based)
40+
start_at = 0, -- {start_options} chosen index (0-based)
3641
window_pos_x = false,
3742
window_pos_y = false,
3843
}
@@ -78,8 +83,8 @@ local function user_dialog()
7883
utils.show_notes_dialog(dialog, "About " .. name, 300, 155)
7984
refocus_document = true
8085
end
81-
local function cstat(x, wide, str)
82-
dialog:CreateStatic(x, y):SetWidth(wide):SetText(str)
86+
local function cstat(x, wide, str, id)
87+
dialog:CreateStatic(x, y, id):SetWidth(wide):SetText(str)
8388
end
8489
cstat(0, 190, "Assign Playback of All Expressions")
8590
y = y + 22
@@ -93,9 +98,11 @@ local function user_dialog()
9398
end
9499
else
95100
save = tonumber(s:sub(-1)) or 0
101+
dialog:GetControl("data"):SetText(special_layer[save] or "")
96102
end
97103
self:SetInteger(save):SetKeyboardFocus()
98104
end)
105+
cstat(x_off + 28, 110, (special_layer[save] or ""), "data")
99106
y = y + 22
100107
cstat(0, 160, "Begin Playback At:")
101108
dialog:CreateButton(165, y, "q"):SetText("?"):SetWidth(20)
@@ -105,7 +112,7 @@ local function user_dialog()
105112
labels:CopyFromStringTable(start_options[1])
106113
dialog:CreateRadioButtonGroup(x_off, y, 3, "start_at")
107114
:SetText(labels):SetWidth(130)
108-
:SetSelectedItem(c.start_at - 1)
115+
:SetSelectedItem(c.start_at)
109116
y = y + 14
110117
cstat(x_off / 2, 50, "[" .. hotkey.start_at .. "]")
111118
dialog:CreateOkButton()
@@ -116,7 +123,7 @@ local function user_dialog()
116123
q:SetFont(q:CreateFontInfo():SetBold(true)) end)
117124
dialog:RegisterHandleOkButtonPressed(function()
118125
c.layer = dialog:GetControl("layer"):GetInteger()
119-
c.start_at = dialog:GetControl("start_at"):GetSelectedItem() + 1
126+
c.start_at = dialog:GetControl("start_at"):GetSelectedItem() -- 0-based
120127
end)
121128
dialog:RegisterCloseWindow(function(self) dialog_save_position(self) end)
122129
return (dialog:ExecuteModal() == finale.EXECMODAL_OK)
@@ -134,7 +141,7 @@ local function playback_layer()
134141
local mod_key = qim and (qim(finale.CMDMODKEY_ALT) or qim(finale.CMDMODKEY_SHIFT))
135142

136143
if mod_key or user_dialog() then
137-
local start_option = start_options[2][c.start_at] -- user choice -> actual index
144+
local start_option = start_options[2][c.start_at + 1] -- user choice -> actual index
138145
local expressions = finale.FCExpressions()
139146
expressions:LoadAllForRegion(finenv.Region())
140147
for exp in each(expressions) do

0 commit comments

Comments
 (0)