Skip to content

Commit

Permalink
chore: autopublish 2024-04-13T15:42:12Z
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 13, 2024
1 parent c8ebdaa commit 8a5a821
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
38 changes: 29 additions & 9 deletions dist/rest_slider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5300,10 +5300,10 @@ function plugindef()
finaleplugin.Author = "Carl Vine"
finaleplugin.AuthorURL = "https://carlvine.com/lua/"
finaleplugin.Copyright = "CC0 https://creativecommons.org/publicdomain/zero/1.0/"
finaleplugin.Version = "0.31"
finaleplugin.Date = "2024/03/02"
finaleplugin.Version = "0.33" -- trying RegisterMouseTracking
finaleplugin.Date = "2024/04/10"
finaleplugin.CategoryTags = "Rests, Selection"
finaleplugin.MinJWLuaVersion = 0.70
finaleplugin.MinJWLuaVersion = 0.72
finaleplugin.Notes = [[
Slide rests up and down on the nominated layer with continuous visual feedback.
This was designed especially to help align rests midway
Expand Down Expand Up @@ -5336,7 +5336,7 @@ function plugindef()
> - __f__: move to mid-staff below (if one staff selected)
> - __z__: reset to "zero" shift (not floating)
> - __x__: floating rests
> - __i__: invert shift direction
> - __c__: invert shift direction
> - __q__: show these script notes
> - __m__: toggle "Modeless"
> - __0-4__: layer number (delete key not needed)
Expand All @@ -5357,7 +5357,7 @@ function plugindef()
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b f}: move to mid-staff below (if one staff selected)\par}
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b z}: reset to \u8220"zero\u8221" shift (not floating)\par}
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b x}: floating rests\par}
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b i}: invert shift direction\par}
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b c}: invert shift direction\par}
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b q}: show these script notes\par}
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b m}: toggle \u8220"Modeless\u8221"\par}
{\pard \sl264 \slmult1 \ql \f0 \sa0 \li1080 \fi-360 \bullet \tx360\tab {\b 0-4}: layer number (delete key not needed)\sa180\par}
Expand Down Expand Up @@ -5387,6 +5387,7 @@ local bounds = {
"StartStaff", "StartMeasure", "StartMeasurePos",
"EndStaff", "EndMeasure", "EndMeasurePos",
}
local mouse_tracking = false
local selection
local function dialog_set_position(dialog)
if config.window_pos_x and config.window_pos_y then
Expand Down Expand Up @@ -5458,6 +5459,10 @@ local function initialise_parameters()
end
end
end
local function start_undo_block(layer_num, shift)
local id = string.format("%s %s L.%d pos.%d", name, selection.region, layer_num, shift)
finenv.StartNewUndoBlock(id, false)
end
local function get_rest_offset(entry)
if entry:IsNote() then return 0 end
local spec = finale.FCCurrentStaffSpec()
Expand Down Expand Up @@ -5536,14 +5541,17 @@ local function run_the_dialog_box()
y = diff and (y + diff) or (y + 25)
end
local function shift_rests(shift, float)
local id = string.format("%s %s L%d pos%d", name, selection.region, save_layer, shift)
if config.modeless then finenv.StartNewUndoBlock(id, false) end
if config.modeless and not mouse_tracking then
start_undo_block(save_layer, shift)
end
for entry in eachentrysaved(finenv.Region(), save_layer) do
if entry:IsRest() then
offset_rest(entry, shift, float)
end
end
if config.modeless then finenv.EndUndoBlock(true) end
if config.modeless and not mouse_tracking then
finenv.EndUndoBlock(true)
end
finenv.Region():Redraw()
end
local function set_value(thumb, float, set_thumb)
Expand Down Expand Up @@ -5587,7 +5595,7 @@ local function run_the_dialog_box()
elseif val:find("f") then set_midstaff("below")
elseif val:find("z") then set_zero(false)
elseif val:find("x") then set_zero(true)
elseif val:find("i") then invert_shift()
elseif val:find("c") then invert_shift()
elseif val:find("m") then
answer.modeless:SetCheck((answer.modeless:GetCheck() + 1) % 2)
end
Expand Down Expand Up @@ -5653,6 +5661,18 @@ local function run_the_dialog_box()
dialog:RegisterHandleOkButtonPressed(function()
save_rest_positions()
end)
dialog:RegisterMouseTrackingStarted(function(cntl)
mouse_tracking = true
if config.modeless then
start_undo_block(save_layer, cntl:GetThumbPosition() - center)
end
end)
dialog:RegisterMouseTrackingStopped(function()
if config.modeless and mouse_tracking then
mouse_tracking = false
finenv.EndUndoBlock(true)
end
end)
dialog:RegisterInitWindow(function(self)
dialog:SetOkButtonCanClose(not config.modeless)
if config.modeless then self:SetTimer(config.timer_id, 125) end
Expand Down
2 changes: 1 addition & 1 deletion hash/rest_slider.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ce3d8c4dfb65df4c5789f1a077a7561678e10a3d7f58fc05e2781ac295170acc55cf9d18244a3921a07633f8504a5c6898538cab5ce517b6b714c8207307c2e3 rest_slider.lua
7569e3240c45063885f5573c48ceceaec9244b2cb62fa533659ffbd3fb2c8efad268801d9c6d3733d224fc2fa09f68901aeb3d4fa5d925b773084aafa57410b5 rest_slider.lua

0 comments on commit 8a5a821

Please sign in to comment.