Skip to content

Commit

Permalink
feat: make enter visual timeline mode not clear selection,
Browse files Browse the repository at this point in the history
add new binding <M-v>

which does old behaviour of clearing timeline selection
  • Loading branch information
gwatcha committed Sep 7, 2020
1 parent c928c90 commit a6188c3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions definitions/defaults/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion definitions/defaults/global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ return {
},
timeline_selector = {
["~"] = "MarkedRegion",
["v"] = "TimeSelection",
["!"] = "LoopSelection",
["<S-right>"] = "NextRegion",
["<S-left>"] = "PrevRegion",
Expand Down Expand Up @@ -76,6 +75,7 @@ return {
["<C-z>"] = "ZoomUndo",
["<C-Z>"] = "ZoomRedo",
["v"] = "SetModeVisualTimeline",
["<M-v>"] = "ClearTimelineSelectionAndSetModeVisualTimeline",
["<C-SPC>"] = "ToggleViewMixer",
["<ESC>"] = "Reset",
["<return>"] = "StartStop",
Expand Down
1 change: 0 additions & 1 deletion definitions/defaults/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ return {
},
track_selector = {
["'"] = "MarkedTracks",
["V"] = "Selection",
["c"] = "FolderChildren",
["F"] = "FolderParent",
["F"] = "Folder",
Expand Down
5 changes: 5 additions & 0 deletions internal/custom_actions/custom_actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions internal/library/state.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local state_interface = require('state_machine.state_interface')
local config = require('definitions.config')

local state = {}

Expand All @@ -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
Expand Down

0 comments on commit a6188c3

Please sign in to comment.