Compare commits
No commits in common. "3a4d7aab2eb423820b566f29a1ca2f1521368168" and "fa570bbb4b15021527718a2f66ee9abe34bda839" have entirely different histories.
3a4d7aab2e
...
fa570bbb4b
@ -10,12 +10,10 @@
|
|||||||
-- Basic gui stuff by forum user "spk77": https://forum.cockos.com/showthread.php?t=161557
|
-- Basic gui stuff by forum user "spk77": https://forum.cockos.com/showthread.php?t=161557
|
||||||
|
|
||||||
|
|
||||||
-- Some adjustable settings (startup settings that can be changed in GUI):
|
-- Some adjustable settings:
|
||||||
local timeSinceProject = true -- EITHER this one is true OR one of the next two
|
local timeSinceProject = true -- EITHER this one is true OR one of the next two
|
||||||
local timeSinceMarker = false
|
local timeSinceMarker = false
|
||||||
local timeSinceRegion = false
|
local timeSinceRegion = false
|
||||||
local timeUnitHMS = false -- EITHER this one is true OR one of the next one
|
|
||||||
local timeUnitMeasures = true
|
|
||||||
|
|
||||||
-- Nothing to adjust here anymore...
|
-- Nothing to adjust here anymore...
|
||||||
local script_path
|
local script_path
|
||||||
@ -30,13 +28,6 @@ function msg(m)
|
|||||||
reaper.ShowConsoleMsg(tostring(m) .. "\n")
|
reaper.ShowConsoleMsg(tostring(m) .. "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Round number
|
|
||||||
function round(num, numDecimalPlaces)
|
|
||||||
local mult = 10^(numDecimalPlaces or 0)
|
|
||||||
return math.floor(num * mult + 0.5) / mult
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Store state to project variables
|
-- Store state to project variables
|
||||||
function storeExtState()
|
function storeExtState()
|
||||||
if timeSinceProject then
|
if timeSinceProject then
|
||||||
@ -57,12 +48,6 @@ function storeExtState()
|
|||||||
reaper.SetProjExtState(0, 'bigclock_extra', 'timeSinceRegion', '0')
|
reaper.SetProjExtState(0, 'bigclock_extra', 'timeSinceRegion', '0')
|
||||||
end
|
end
|
||||||
|
|
||||||
if timeUnitMeasures then
|
|
||||||
reaper.SetProjExtState(0, 'bigclock_extra', 'timeUnit', 'measures')
|
|
||||||
else
|
|
||||||
reaper.SetProjExtState(0, 'bigclock_extra', 'timeUnit', 'hms')
|
|
||||||
end
|
|
||||||
|
|
||||||
reaper.SetProjExtState(0, 'bigclock_extra', 'dockState', gfx.dock(-1))
|
reaper.SetProjExtState(0, 'bigclock_extra', 'dockState', gfx.dock(-1))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -104,15 +89,9 @@ function gui_init()
|
|||||||
rc_menu:add_item({label = "Time since previous marker",
|
rc_menu:add_item({label = "Time since previous marker",
|
||||||
toggleable = true,
|
toggleable = true,
|
||||||
selected = timeSinceMarker})
|
selected = timeSinceMarker})
|
||||||
rc_menu:add_item({label = "Time since previous region|",
|
rc_menu:add_item({label = "Time since previous region",
|
||||||
toggleable = true,
|
toggleable = true,
|
||||||
selected = timeSinceRegion})
|
selected = timeSinceRegion})
|
||||||
rc_menu:add_item({label = "HH:MM:SS.xxx",
|
|
||||||
toggleable = true,
|
|
||||||
selected = timeUnitHMS})
|
|
||||||
rc_menu:add_item({label = "Measures.Beats.xx|",
|
|
||||||
toggleable = true,
|
|
||||||
selected = timeUnitMeasures})
|
|
||||||
rc_menu:add_item({label = "Quit"})
|
rc_menu:add_item({label = "Quit"})
|
||||||
|
|
||||||
-- Let's add a command to all created items:
|
-- Let's add a command to all created items:
|
||||||
@ -155,29 +134,7 @@ function gui_init()
|
|||||||
end
|
end
|
||||||
storeExtState()
|
storeExtState()
|
||||||
end
|
end
|
||||||
rc_menu.items[4].command = function()
|
rc_menu.items[4].command = function() quit = true end
|
||||||
if rc_menu.items[4].selected then
|
|
||||||
timeUnitHMS = true
|
|
||||||
timeUnitMeasures = false
|
|
||||||
rc_menu.items[5].selected = false
|
|
||||||
else
|
|
||||||
--dont let user disable option but force selection of other option
|
|
||||||
rc_menu.items[5].selected = true;
|
|
||||||
end
|
|
||||||
storeExtState()
|
|
||||||
end
|
|
||||||
rc_menu.items[5].command = function()
|
|
||||||
if rc_menu.items[5].selected then
|
|
||||||
timeUnitHMS = false
|
|
||||||
timeUnitMeasures = true
|
|
||||||
rc_menu.items[4].selected = false
|
|
||||||
else
|
|
||||||
--dont let user disable option but force selection of other option
|
|
||||||
rc_menu.items[4].selected = true;
|
|
||||||
end
|
|
||||||
storeExtState()
|
|
||||||
end
|
|
||||||
rc_menu.items[6].command = function() quit = true end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Draw GUI --
|
-- Draw GUI --
|
||||||
@ -186,11 +143,7 @@ function drawGui()
|
|||||||
local val
|
local val
|
||||||
local timeRaw
|
local timeRaw
|
||||||
local timeDisplay
|
local timeDisplay
|
||||||
local timeDisplayHours
|
|
||||||
local timeDisplayMinutes
|
|
||||||
local timeDisplaySeconds
|
local timeDisplaySeconds
|
||||||
local timeMeasures
|
|
||||||
local timeBeats
|
|
||||||
local markerId
|
local markerId
|
||||||
local regionId
|
local regionId
|
||||||
local isRegion
|
local isRegion
|
||||||
@ -215,31 +168,13 @@ function drawGui()
|
|||||||
end
|
end
|
||||||
if retval > 0 then timeRaw = timeRaw - markerRegionPos end
|
if retval > 0 then timeRaw = timeRaw - markerRegionPos end
|
||||||
|
|
||||||
-- Construct display string
|
-- construct display string, with leading zeros if neccessary (e.g. 27:08.321)
|
||||||
if timeUnitMeasures then
|
timeDisplaySeconds = math.floor((timeRaw%60)*1000)/1000
|
||||||
-- measures and beats: e.g. 07.3.99
|
timeDisplay = math.floor(timeRaw/60) .. ":"
|
||||||
timeBeats, timeMeasures, _, _, _ = reaper.TimeMap2_timeToBeats(0, timeRaw)
|
|
||||||
timeDisplay = timeMeasures+1 .. '.' .. round(timeBeats+1, 2)
|
|
||||||
else
|
|
||||||
-- minutes and seconds: MM:SS.xxx (e.g. 27:08.321)
|
|
||||||
timeDisplayHours = math.floor(timeRaw/3600)
|
|
||||||
timeRaw = timeRaw%3600
|
|
||||||
timeDisplayMinutes = math.floor(timeRaw/60)
|
|
||||||
timeDisplaySeconds = round(timeRaw%60, 3)
|
|
||||||
if timeDisplayHours > 0 then
|
|
||||||
timeDisplay = timeDisplayHours .. ":"
|
|
||||||
if timeDisplayMinutes < 10 then
|
|
||||||
timeDisplay = timeDisplay .. "0"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
timeDisplay = ""
|
|
||||||
end
|
|
||||||
timeDisplay = timeDisplay .. timeDisplayMinutes .. ":"
|
|
||||||
if timeDisplaySeconds < 10 then
|
if timeDisplaySeconds < 10 then
|
||||||
timeDisplay = timeDisplay .. "0"
|
timeDisplay = timeDisplay .. "0"
|
||||||
end
|
end
|
||||||
timeDisplay = timeDisplay .. timeDisplaySeconds
|
timeDisplay = timeDisplay .. timeDisplaySeconds
|
||||||
end
|
|
||||||
|
|
||||||
gfx.clear = 3355443 -- background is dark grey
|
gfx.clear = 3355443 -- background is dark grey
|
||||||
|
|
||||||
@ -325,16 +260,6 @@ function init()
|
|||||||
timeSinceRegion = false
|
timeSinceRegion = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
retval, val = reaper.GetProjExtState(0, 'bigclock_extra', 'timeUnit')
|
|
||||||
if retval > 0 then
|
|
||||||
if val == 'measures' then
|
|
||||||
timeUnitMeasures = true
|
|
||||||
timeUnitHMS = false
|
|
||||||
else
|
|
||||||
timeUnitMeasures = false
|
|
||||||
timeUnitHMS = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- init stuff...
|
-- init stuff...
|
||||||
gui_init()
|
gui_init()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user