Skip to content

Commit 8d94979

Browse files
authored
Rgp changes for rgplua 0.72 (#716)
* add mouse tracking events to slider sample * couple of minor changes to samples * documentation update * DoSomething opens a modal window. * fiddle with modeless dialog sample * modeless sample modified for testing console * Add `IsActive` to finenv doc. * rename IsScriptActive func * eat own dogfood plus lint bugfix * initial checkin of key mode editor * refinement * Use FCKeySignature to get default values. * get major/minor from key sig * doc update * moving ahead with keymode editor * added base info * init popup with current selection * checkpoint * delete working * save existing is working * Save button fully implemented * added beginning of symbol editor * bugfixes for windows * revisions towards actually using the symbol editor * symbol font encoding * more efficient calls * bugfix * various fixes * rework font stuff for accidental symbol font * symbol list editor code complete * feature complete; aesthetic changes still required * aesthetic fixes * little improvements to key mode editor * fix typo
1 parent 0db2c18 commit 8d94979

8 files changed

+1014
-14
lines changed

docs/rgp-lua/finenv-properties.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Returns an instance of `FCLuaScriptItems` that can be used to launch ad-hoc scri
4949

5050
##### Inputs:
5151

52-
- `string1` : A Lua string containing the fully qualified path to the script file.
52+
- `string1` : [optional] A Lua string containing the fully qualified path to the script file. If this parameter is omitted, it still creates a collection with one item. You can then supply the Lua code with the item's `SetOptionalScriptText` method.
5353
- `string2` : [optional] A Lua string containing the Lua code to execute. If this parameter is provided, the contents of the fully qualified path are ignored, though RGP Lua will continue to use the path for display and security purposes.
5454

5555
##### Outputs:
@@ -196,6 +196,12 @@ end
196196

197197
---
198198

199+
#### IsScriptActive\* (function)
200+
201+
Boolean function that should always return `true`. This value is primarily useful as a diagnostic tool for testing _RGP Lua_. It proves that the plugin can find a running script from its Lua state, even if that Lua state is a coroutine state. Normal scripts probably never need to access this function.
202+
203+
---
204+
199205
#### LoadedAsString\* (read-only property)
200206

201207
A read-only property that returns the setting of “Load As String”, either from _RGP Lua’s_ configuration dialog or from the `plugindef()` function, whichever is in effect.

docs/rgp-lua/rgp-lua-console.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ The Console recognizes standard keyboard navigation commands for each operating
4545

4646
#### File Popup Shortcuts
4747

48-
- **New File**: `cmd+N` (macOS) `ctrl+N` (Windows)
48+
- **New File**: `shift-cmd+N` (macOS) `ctrl+N` (Windows)
4949
- **Open File**: `cmd+O` (macOS) `ctrl+O` (Windows)
5050
- **Save File**: `cmd+S` (macOS) `ctrl+S` (Windows)
5151
- **Close File**: `cmd+W` (macOS) `ctrl+W` (Windows)
5252

53+
(Note the `shift` key added for **New File** on macOS. This leaves `cmd+N` available for opening new Finale file while the console is in focus.)
54+
5355
#### Search Shortcuts
5456

5557
- **Find Text**: `cmd+F` (macOS) `ctrl+F` (Windows)

samples/modeless_dialog.lua

+31-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ function plugindef()
44
finaleplugin.Notes = [[
55
This script illustrates how to set up a modeless dialog box.
66
]]
7+
finaleplugin.AdditionalMenuOptions = [[
8+
"0--modeless_dialog.lua 2"
9+
]]
710
return "0--modeless_dialog.lua"
811
end
912

@@ -14,7 +17,29 @@ end
1417
local mixin = require("library.mixin")
1518

1619
local strings = {"Option 1", "Option 2", "Option 3"}
17-
local strings2 = {"Long Suboption 1", "Long Suboption 2"}
20+
local strings2 = { "Long Suboption 1", "Long Suboption 2" }
21+
22+
local function show_self(dlg)
23+
local fpath = finale.FCString()
24+
fpath:SetRunningLuaFolderPath()
25+
local fname = finale.FCString()
26+
fname:SetRunningLuaFilePath()
27+
dlg:CreateChildUI():AlertInfo(fname.LuaString, fpath.LuaString)
28+
end
29+
30+
local function modal_dialog() -- luacheck: ignore
31+
local dlg = mixin.FCXCustomLuaWindow()
32+
dlg:SetTitle("Modal Popup")
33+
dlg:CreateButton(0, 0)
34+
:SetText("Popup Message")
35+
:SetWidth(150)
36+
:AddHandleCommand(function(_control)
37+
show_self(dlg)
38+
end)
39+
dlg:CreateOkButton()
40+
dlg:CreateCancelButton()
41+
dlg:ExecuteModal()
42+
end
1843

1944
local function create_dialog()
2045
local dlg = mixin.FCXCustomLuaWindow()
@@ -66,10 +91,14 @@ local function create_dialog()
6691

6792
dlg:RegisterHandleControlEvent(do_something,
6893
function(_control)
94+
show_self(dlg)
95+
-- modal_dialog()
96+
--[[
6997
local grp1 = global_dialog:GetControl("radio1")
7098
print("radio group 1 selected item: " .. grp1:GetSelectedItem())
7199
local grp2 = global_dialog:GetControl("radio2")
72-
print("radio group 1 selected item: " .. grp2:GetSelectedItem())
100+
print("radio group 2 selected item: " .. grp2:GetSelectedItem())
101+
]]
73102
--[[
74103
finenv.StartNewUndoBlock("Playback Region", false)
75104
finenv.Region():Playback()
@@ -92,13 +121,6 @@ local function create_dialog()
92121
end
93122
]]
94123
--[[
95-
local fpath = finale.FCString()
96-
fpath:SetRunningLuaFolderPath()
97-
local fname = finale.FCString()
98-
fname:SetRunningLuaFilePath()
99-
finenv.UI():AlertInfo(fname.LuaString, fpath.LuaString)
100-
]]
101-
--[[
102124
local function fcstr(s)
103125
local str = finale.FCString()
104126
str.LuaString = s

samples/slider_control.lua

+15-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,27 @@ slider:SetThumbPosition(2)
2020
str.LuaString = "Thumb position: " .. slider:GetThumbPosition()
2121
static:SetText(str)
2222

23+
dialog:CreateOkButton()
24+
dialog:CreateCancelButton()
25+
2326
dialog:RegisterHandleControlEvent(slider, function(ctrl)
2427
local thumb_pos = ctrl:GetThumbPosition()
2528
str.LuaString = "Thumb position: " .. tostring(thumb_pos)
2629
print(str.LuaString)
2730
static:SetText(str)
2831
end)
2932

30-
--require('mobdebug').start()
31-
dialog:ExecuteModal(nil)
33+
dialog:RegisterMouseTrackingStarted(function(ctrl)
34+
local thumb_pos = ctrl:GetThumbPosition()
35+
print("Slider tracking started: " .. thumb_pos)
36+
end)
37+
38+
dialog:RegisterMouseTrackingStopped(function(ctrl)
39+
local thumb_pos = ctrl:GetThumbPosition()
40+
print("Slider tracking stopped: " .. thumb_pos)
41+
end)
42+
43+
local result = dialog:ExecuteModal(nil)
44+
print("ExecuteModal returned: " .. result)
3245

3346
finenv.UI():AlertInfo("Thumb position: " .. tostring(slider:GetThumbPosition()), "")

0 commit comments

Comments
 (0)