From a6188c33fb9da77f7ca0528149ad489b88e31128 Mon Sep 17 00:00:00 2001 From: mostlysimlar Date: Sun, 6 Sep 2020 21:01:47 -0700 Subject: [PATCH] feat: make enter visual timeline mode not clear selection, add new binding which does old behaviour of clearing timeline selection --- definitions/defaults/actions.lua | 2 ++ definitions/defaults/global.lua | 2 +- definitions/defaults/main.lua | 1 - internal/custom_actions/custom_actions.lua | 5 +++++ internal/library/state.lua | 4 +--- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/definitions/defaults/actions.lua b/definitions/defaults/actions.lua index 0030c589..adee1c36 100644 --- a/definitions/defaults/actions.lua +++ b/definitions/defaults/actions.lua @@ -431,6 +431,8 @@ return { SetModeNormal = lib.state.setModeNormal, PasteItemFxChain = {"_S&M_COPYFXCHAIN9", prefixRepetitionCount=true}, SetModeVisualTimeline = lib.state.setModeVisualTimeline, + ClearSelectedTimeline = custom.clearSelectedTimeline, + ClearTimelineSelectionAndSetModeVisualTimeline = {"ClearSelectedTimeline", "SetModeVisualTimeline"}, SetModeVisualTrack = lib.state.setModeVisualTrack, SetModeRecord = lib.state.setModeRecord, SetProjectTimebaseToBeatsPosLengthAndRate = "_SWS_AWTBASEBEATALL", diff --git a/definitions/defaults/global.lua b/definitions/defaults/global.lua index 6cee01a0..3fcba599 100644 --- a/definitions/defaults/global.lua +++ b/definitions/defaults/global.lua @@ -35,7 +35,6 @@ return { }, timeline_selector = { ["~"] = "MarkedRegion", - ["v"] = "TimeSelection", ["!"] = "LoopSelection", [""] = "NextRegion", [""] = "PrevRegion", @@ -76,6 +75,7 @@ return { [""] = "ZoomUndo", [""] = "ZoomRedo", ["v"] = "SetModeVisualTimeline", + [""] = "ClearTimelineSelectionAndSetModeVisualTimeline", [""] = "ToggleViewMixer", [""] = "Reset", [""] = "StartStop", diff --git a/definitions/defaults/main.lua b/definitions/defaults/main.lua index 3eb9e25e..59b298e9 100644 --- a/definitions/defaults/main.lua +++ b/definitions/defaults/main.lua @@ -25,7 +25,6 @@ return { }, track_selector = { ["'"] = "MarkedTracks", - ["V"] = "Selection", ["c"] = "FolderChildren", ["F"] = "FolderParent", ["F"] = "Folder", diff --git a/internal/custom_actions/custom_actions.lua b/internal/custom_actions/custom_actions.lua index 4d5ac645..761ccae1 100644 --- a/internal/custom_actions/custom_actions.lua +++ b/internal/custom_actions/custom_actions.lua @@ -36,6 +36,11 @@ function custom_actions.setMidiGridDivision() end end +function custom_actions.clearSelectedTimeline() + local current_position = reaper.GetCursorPosition() + reaper.GetSet_LoopTimeRange(true, false, current_position, current_position, false) +end + function custom_actions.setGridDivision() local division = getUserGridDivisionInput() if division then diff --git a/internal/library/state.lua b/internal/library/state.lua index 657abbbd..3b76fe8d 100644 --- a/internal/library/state.lua +++ b/internal/library/state.lua @@ -1,4 +1,5 @@ local state_interface = require('state_machine.state_interface') +local config = require('definitions.config') local state = {} @@ -19,10 +20,7 @@ function state.setModeVisualTrack() end function state.setModeVisualTimeline() - local current_position = reaper.GetCursorPosition() - reaper.GetSet_LoopTimeRange(true, false, current_position, current_position, false) state_interface.setMode('visual_timeline') - if state_interface.getTimelineSelectionSide() == 'left' then state_interface.setTimelineSelectionSide('right') end