Skip to content

Commit 8ec262f

Browse files
authored
move development-related script out of the Various category (ReaTeam#61)
1 parent c35428a commit 8ec262f

5 files changed

+65
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
-- @description GFX Keyboard Inspector
2+
-- @author cfillion
3+
-- @version 1.0
4+
5+
function iswindows()
6+
return reaper.GetOS():find('Win') ~= nil
7+
end
8+
9+
function ismacos()
10+
return reaper.GetOS():find('OSX') ~= nil
11+
end
12+
13+
function modifiers()
14+
local mods = {}
15+
16+
if gfx.mouse_cap & 4 ~= 0 then
17+
if ismacos() then
18+
table.insert(mods, 'Cmd')
19+
else
20+
table.insert(mods, 'Ctrl')
21+
end
22+
end
23+
if ismacos() and gfx.mouse_cap & 32 ~= 0 then
24+
table.insert(mods, 'Ctrl')
25+
end
26+
if gfx.mouse_cap & 16 ~= 0 then
27+
if ismacos() then
28+
table.insert(mods, 'Opt')
29+
else
30+
table.insert(mods, 'Alt')
31+
end
32+
end
33+
if gfx.mouse_cap & 8 ~= 0 then
34+
table.insert(mods, 'Shift')
35+
end
36+
37+
if #mods == 0 then
38+
return 'No modifiers!'
39+
else
40+
return table.concat(mods, '+')
41+
end
42+
end
43+
44+
function loop()
45+
local char = gfx.getchar()
46+
47+
if char < 0 then
48+
gfx.quit()
49+
return
50+
elseif char > 0 then
51+
last_char = char
52+
end
53+
54+
gfx.x, gfx.y = 10, 10
55+
gfx.drawstr(modifiers())
56+
57+
gfx.x, gfx.y = 10, 25
58+
gfx.drawstr(string.format("%d %d", gfx.mouse_cap, last_char or 0))
59+
60+
gfx.update()
61+
reaper.defer(loop)
62+
end
63+
64+
gfx.init("GFX KB Inspector", 200, 50)
65+
reaper.defer(loop)

0 commit comments

Comments
 (0)