Created
April 20, 2019 16:04
-
-
Save jtackaberry/939e71cb2cb61d89f65e95c7efb6a162 to your computer and use it in GitHub Desktop.
Reaper action to toggle docking of MIDI editor which also toggles sync to arrange view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
* ReaScript Name: Toggle docked MIDI editor | |
* Author: Jason Tackaberry (tack) | |
* Licence: Public Domain | |
* Extensions: None | |
* Version: 1.0 | |
--]] | |
MIDI_SECTION_ID = 32060 | |
reaper.PreventUIRefresh(1) | |
local hwnd = reaper.MIDIEditor_GetActive() | |
if not hwnd then | |
-- View: Toggle show MIDI editor windows | |
reaper.Main_OnCommandEx(40716, 0, 0) | |
hwnd = reaper.MIDIEditor_GetActive() | |
end | |
-- Options: Toggle window docking | |
local docked = reaper.GetToggleCommandStateEx(MIDI_SECTION_ID, 40018) | |
-- Timebase: Sync to arrange view | |
local synced = reaper.GetToggleCommandStateEx(MIDI_SECTION_ID, 40461) | |
-- Contents: Show/hide media item lane | |
local lane = reaper.GetToggleCommandStateEx(MIDI_SECTION_ID, 40819) | |
-- Toggle docking | |
reaper.MIDIEditor_OnCommand(hwnd, 40018) | |
if docked == 1 then | |
if synced == 1 then | |
reaper.MIDIEditor_OnCommand(hwnd, 40640) | |
end | |
if lane == 0 then | |
reaper.MIDIEditor_OnCommand(hwnd, 40819) | |
end | |
reaper.MIDIEditor_OnCommand(hwnd, 1012) | |
reaper.MIDIEditor_OnCommand(hwnd, 1011) | |
else | |
if synced == 0 then | |
reaper.MIDIEditor_OnCommand(hwnd, 40640) | |
end | |
if lane == 1 then | |
reaper.MIDIEditor_OnCommand(hwnd, 40819) | |
end | |
end | |
reaper.PreventUIRefresh(-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment