-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release Insert project marker under mouse or play cursor v1.0 (#1311)
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
Markers/az_Insert project marker under mouse or play cursor.lua
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
-- @description Insert project marker under mouse or play cursor | ||
-- @author AZ | ||
-- @version 1.0 | ||
-- @provides | ||
-- [main=main,midi_editor] . | ||
-- [main=main,midi_editor] az_Insert project marker under mouse or play cursor/az_Insert project marker and edit it under mouse or play cursor.lua | ||
-- @link Forum thread https://forum.cockos.com/showthread.php?t=288069 | ||
-- @donation Donate via PayPal https://www.paypal.me/AZsound | ||
-- @about | ||
-- SWS is required | ||
-- | ||
-- This script brings usability of project markers closer to the take markers. | ||
-- | ||
-- If mouse placed in arrange - use mouse position for marker, else use edit or play cursor position. | ||
|
||
function ins_proj_marker() | ||
window, segment, details = reaper.BR_GetMouseCursorContext() | ||
|
||
if window == "arrange" or window == "midi_editor" then | ||
pos = reaper.BR_GetMouseCursorContext_Position() | ||
|
||
if window == "midi_editor" then | ||
if segment == "unknown"or segment == "notes"or segment == "cc_lane" then | ||
reaper.AddProjectMarker2( 0, false, pos, 0, "", -1, 0 ) | ||
else | ||
reaper.Main_OnCommandEx( reaper.NamedCommandLookup( "_S&M_INS_MARKER_PLAY" ), 0, 0 ) | ||
end | ||
else | ||
reaper.AddProjectMarker2( 0, false, pos, 0, "", -1, 0 ) | ||
end | ||
else | ||
reaper.Main_OnCommandEx( reaper.NamedCommandLookup( "_S&M_INS_MARKER_PLAY" ), 0, 0 ) | ||
end | ||
|
||
end | ||
|
||
|
||
|
||
reaper.Undo_BeginBlock2( 0 ) | ||
ins_proj_marker() | ||
reaper.Undo_EndBlock2( 0, "Insert project marker", -1 ) |
49 changes: 49 additions & 0 deletions
49
... mouse or play cursor/az_Insert project marker and edit it under mouse or play cursor.lua
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
-- @noindex | ||
|
||
function ins_marker_mouse() | ||
reaper.Main_OnCommandEx( 40513, 0, 0 ) --View: Move edit cursor to mouse cursor | ||
reaper.Main_OnCommandEx( 40171, 0, 0 ) --Insert and/or edit marker at current position | ||
reaper.SetEditCurPos2( 0, edit_cur_pos, false, false ) | ||
end | ||
|
||
---------- | ||
---------- | ||
|
||
function ins_marker_play() | ||
reaper.Main_OnCommandEx( 40434, 0, 0 ) --View: Move edit cursor to play cursor | ||
reaper.Main_OnCommandEx( 40171, 0, 0 ) --Insert and/or edit marker at current position | ||
reaper.SetEditCurPos2( 0, edit_cur_pos, false, false ) | ||
end | ||
|
||
------------------------------- | ||
------------------------------- | ||
|
||
function ins_proj_marker() | ||
edit_cur_pos = reaper.GetCursorPositionEx( 0 ) | ||
window, segment, details = reaper.BR_GetMouseCursorContext() | ||
|
||
if window == "arrange" or window == "midi_editor" then | ||
pos = reaper.BR_GetMouseCursorContext_Position() | ||
|
||
if window == "midi_editor" then | ||
if segment == "unknown"or segment == "notes"or segment == "cc_lane" then | ||
ins_marker_mouse() | ||
else | ||
ins_marker_play() | ||
end | ||
else | ||
ins_marker_mouse() | ||
end | ||
else | ||
ins_marker_play() | ||
end | ||
|
||
end | ||
|
||
|
||
|
||
reaper.Undo_BeginBlock2( 0 ) | ||
reaper.PreventUIRefresh( 1 ) | ||
ins_proj_marker() | ||
reaper.PreventUIRefresh( -1 ) | ||
reaper.Undo_EndBlock2( 0, "Insert project marker", -1 ) |