Old 06-05-2019, 02:42 PM   #1
Delucci
Human being with feelings
 
Join Date: May 2017
Posts: 325
Default Zooming to edit cursor (help scripting)

So.. I created a couple threads in other sections asking if it is possible to zoom horizontally to my mouse pointer with shortcut+mousewheel (ex: shift+mwheel) AND zoom horizontally to edit cursor with other hotkeys (T, R, for example).

Zero answers in all threads, so I decided to try to create a script (or someone to help me a lot), basically I would like to keep the option "Zoom horizontally" to my mouse cursor, and create 2 scripts to get my edit cursor position and zoom to it, is it possible? Thanks in advance!
Delucci is offline   Reply With Quote
Old 06-06-2019, 06:05 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

These should help you:

This gets the edit-cursor-position:
https://mespotin.uber.space/Ultrasch...CursorPosition

This sets/adjusts the zoom-factor:
https://mespotin.uber.space/Ultrasch...tml#adjustZoom

These should help you writing/reading the current state from an internal variable, which is a concept in Reaper called extstate:
https://mespotin.uber.space/Ultrasch...ml#GetExtState





For more advanced zoom-stuff, you may want to look into them here as well:

This gets/sets the arrangeview-time-selection
https://mespotin.uber.space/Ultrasch...GetArrangeView

https://mespotin.uber.space/Ultrasch...SetArrangeView
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 06-06-2019 at 06:10 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-06-2019, 09:40 PM   #3
Delucci
Human being with feelings
 
Join Date: May 2017
Posts: 325
Default

Thanks a lot! I looked for some Reascript documentation, but this one explains much better
Delucci is offline   Reply With Quote
Old 06-11-2019, 12:38 PM   #4
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

There is a preference for making the edit cursor the horizontal zooming centre for the zoom key commands. This still lets the zoom via mousewheel act with the mouse as zoom centre. Isn't that what you need - no scripts necessary!?
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 06-11-2019, 01:03 PM   #5
Delucci
Human being with feelings
 
Join Date: May 2017
Posts: 325
Default

Quote:
Originally Posted by Triode View Post
There is a preference for making the edit cursor the horizontal zooming centre for the zoom key commands. This still lets the zoom via mousewheel act with the mouse as zoom centre. Isn't that what you need - no scripts necessary!?
Yeah, There is? I'm just aware of "Horizontal zoom center" in editing behavior. By the way, I gave up with the script I created because it doesnt work in midi editor, only in arrange view
Delucci is offline   Reply With Quote
Old 06-11-2019, 01:19 PM   #6
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

I think if you set horizontal zoom centre to "edit cursor" all the time and then set the mousewheel to zoom in horizontally it will zoom around the mouse and disregard the preference. I was using it like that today (although without a modifier on the mousewheel)
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 06-11-2019, 01:31 PM   #7
Delucci
Human being with feelings
 
Join Date: May 2017
Posts: 325
Default

Doesnt work for me, I use alt+mousewheel shortcut to "Zoom horizontally (midi cc relative/mousewheel) but it will center to edit cursor
Delucci is offline   Reply With Quote
Old 06-11-2019, 01:49 PM   #8
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

Ok I checked and I have it set with a macro on each:

For your zoom to edit cursor key command put "set Horizontal zoom center to Edit cursor" first (and then add "zoom in horizontal") in the same macro.

Same for zoom out.

Then add the edit zoom for the mousewheel zoom horizontally (MIDI CC relative/mousewheel) also in a macro

Works here. Let me know how it goes..
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 06-11-2019, 02:27 PM   #9
Delucci
Human being with feelings
 
Join Date: May 2017
Posts: 325
Default

Yeah that works! I created custom action for both zoom modes. I was concerned about performance, since it will be constant changing preferences in the background, but had no issues. Thanks again
Delucci is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.