@@ -4,8 +4,8 @@ function plugindef()
4
4
finaleplugin .Author = " Carl Vine"
5
5
finaleplugin .AuthorURL = " http://carlvine.com/lua/"
6
6
finaleplugin .Copyright = " https://creativecommons.org/licenses/by/4.0/"
7
- finaleplugin .Version = " 0.06 "
8
- finaleplugin .Date = " 2024/04/26 "
7
+ finaleplugin .Version = " 0.10 "
8
+ finaleplugin .Date = " 2024/05/03 "
9
9
finaleplugin .MinJWLuaVersion = 0.62
10
10
finaleplugin .Notes = [[
11
11
There's a couple of __Music Spacing__ options that I
@@ -21,7 +21,6 @@ function plugindef()
21
21
end
22
22
23
23
local config = {
24
- change_hotkeys = " H" ,
25
24
window_pos_x = false ,
26
25
window_pos_y = false ,
27
26
measurement_unit = finale .MEASUREMENTUNIT_DEFAULT ,
@@ -41,7 +40,8 @@ local unisons = {
41
40
}
42
41
local others = {
43
42
{" change_hotkeys" , " H" , " Change Hotkeys" },
44
- {" AutomaticMusicSpacing" , " Z" , " Automatic Music Spacing" }
43
+ {" AutomaticMusicSpacing" , " Z" , " Automatic Music Spacing" },
44
+ {" script_info" , " Q" , " Show Script Info" }
45
45
}
46
46
-- copy hotkeys to config
47
47
for _ , t in ipairs {checks , unisons , others } do
@@ -164,13 +164,13 @@ local function run_the_dialog()
164
164
dialog :SetMeasurementUnit (config .measurement_unit )
165
165
-- local functions
166
166
local function dy (diff ) y = y + (diff and diff or 17 ) end
167
- local function cstat (cx , cy , ctext , cwide , cname )
168
- dialog :CreateStatic (cx , cy , cname ):SetText (ctext ):SetWidth (cwide )
169
- end
170
167
local function show_info ()
171
168
utils .show_notes_dialog (dialog , " About " .. name , 300 , 150 )
172
169
refocus_document = true
173
170
end
171
+ local function cstat (cx , cy , ctext , cwide , cname )
172
+ dialog :CreateStatic (cx , cy , cname ):SetText (ctext ):SetWidth (cwide )
173
+ end
174
174
local function ccheck (cx , cy , cname , ctext , cwide , check )
175
175
dialog :CreateCheckbox (cx , cy , cname ):SetText (ctext ):SetWidth (cwide ):SetCheck (check )
176
176
end
@@ -183,19 +183,18 @@ local function run_the_dialog()
183
183
dialog :GetControl (tostring (i )):SetCheck (i == id and 1 or 0 )
184
184
end
185
185
end
186
- local function rename_checkboxes (array )
187
- for _ , v in ipairs (array ) do
188
- dialog :GetControl (" T" .. v [1 ]):SetText (config [tostring (v [1 ])])
189
- end
190
- end
191
186
local function change_keys ()
192
187
local ok , is_duplicate = true , true
193
188
while ok and is_duplicate do -- wait for good choice in reassign()
194
189
ok , is_duplicate = reassign_keys (dialog )
195
190
end
196
191
if ok then
197
192
for _ , t in ipairs {checks , unisons , others } do
198
- rename_checkboxes (t )
193
+ for _ , v in ipairs (t ) do
194
+ if v [1 ] ~= " script_info" then
195
+ dialog :GetControl (" T" .. v [1 ]):SetText (config [tostring (v [1 ])])
196
+ end
197
+ end
199
198
end
200
199
else -- re-seed hotkeys from user config
201
200
configuration .get_user_settings (script_name , config )
@@ -209,21 +208,17 @@ local function run_the_dialog()
209
208
change_keys ()
210
209
elseif s :find (config .AutomaticMusicSpacing ) then
211
210
toggle_check (" AutomaticMusicSpacing" )
212
- elseif s :find (" ? " ) then show_info ()
211
+ elseif s :find (config . script_info ) then show_info ()
213
212
else
214
- local got = false
215
- for _ , v in ipairs (checks ) do
216
- if s :find (config [v [1 ]]) then
217
- toggle_check (v [1 ])
218
- got = true
219
- break
220
- end
221
- end
222
- if not got then
223
- for _ , v in ipairs (unisons ) do
224
- if s :find (config [tostring (v [1 ])]) then
225
- toggle_unison (v [1 ])
226
- break
213
+ local matched = false
214
+ for _ , array in ipairs {{checks , toggle_check }, {unisons , toggle_unison }} do
215
+ if not matched then
216
+ for _ , v in ipairs (array [1 ]) do
217
+ if s :find (config [tostring (v [1 ])]) then
218
+ array [2 ](v [1 ])
219
+ matched = true
220
+ break
221
+ end
227
222
end
228
223
end
229
224
end
@@ -247,10 +242,10 @@ local function run_the_dialog()
247
242
cstat (x [1 ], y , " Unison Noteheads:" , x [3 ])
248
243
dy ()
249
244
for _ , v in ipairs (unisons ) do
250
- cstat ( x [ 1 ], y , config [ tostring (v [ 1 ])], x [ 2 ], " T " .. v [1 ])
251
- local check = ( prefs . UnisonsMode == v [1 ]) and 1 or 0
252
- ccheck (x [2 ], y , tostring ( v [ 1 ]) , v [3 ], x [3 ] - x [1 ], check )
253
- dialog :GetControl (tostring ( v [ 1 ]) )
245
+ local id = tostring (v [1 ])
246
+ cstat ( x [ 1 ], y , config [ id ], x [ 2 ], " T " .. v [1 ])
247
+ ccheck (x [2 ], y , id , v [3 ], x [3 ] - x [1 ], ( prefs . UnisonsMode == v [ 1 ]) and 1 or 0 )
248
+ dialog :GetControl (id )
254
249
:AddHandleCommand (function () toggle_unison (v [1 ]) end )
255
250
dy ()
256
251
end
@@ -304,11 +299,7 @@ local function run_the_dialog()
304
299
end )
305
300
dialog :RegisterCloseWindow (function (self ) dialog_save_position (self ) end )
306
301
dialog :ExecuteModal ()
307
- end
308
-
309
- local function spacing_hack ()
310
- while run_the_dialog () do end
311
302
if refocus_document then finenv .UI ():ActivateDocumentWindow () end
312
303
end
313
304
314
- spacing_hack ()
305
+ run_the_dialog ()
0 commit comments