|
|
|
09-15-2009, 12:54 AM
|
#1
|
Human being with feelings
Join Date: Jul 2009
Posts: 162
|
Drag zoom plugin
Hi all!
I have made a plugin for "drag zoom" functionality. I must admit that it doesn't work perfectly the way I wanted (details below), and I still believe this would be quite easy for Reaper developers to implement properly. Anyway, this was an interesting project, and I'm eager to hear your comments!
Big thanks to Xenakios for his tip on finding the time display window.
Notes:
- There are two parts of the time display. In the upper part the cursor is a hand, and horizontal drag scrolls the project backward/forward. Vertical drag does nothing, so it seems perfect to use it for zoom in/out. However, there is a problem - the zoom is not centered around the current position, which "runs away" (especially noticeable when zooming in). The adjustZoom() SDK function has "centermode" parameter, but I couldn't find a magic value to make it work properly (well, I tried -1, 0 and 1 )
- Curiously, in the lower part of the time display adjustZoom() works correctly, regardless of "centermode" parameter! However, in this case it is too easy to accidentally change the time selection by dragging horizontally. To prevent this, I ignore the horizontal mouse movement when zooming in lower part - this helped, but sometimes the time selection still changes.
- The plugin registers an action called "Dragzoom Extension : Show Config" which opens a simple configuration dialog. The dialog has no OK or Cancel buttons - simply closing it (e.g. with Esc key) saves the current settings.
- The "scaling" parameter is used to translate vertical movement in pixels to zoom adjustment factor (first parameter to adjustZoom()) - lower value leads to smoother zoom.
- It would be great to implement drag zoom in the MIDI editor as well, but I'm not sure if it's possible.
Please try the plugin and let me know what you think.
|
|
|
09-15-2009, 04:53 AM
|
#2
|
Human being with feelings
Join Date: Aug 2006
Location: Berlin
Posts: 11,839
|
Works ok for me. Using the pre-release 311 beta.
It creates/changes the time selection every time, which changes as we zoom in and out. Nevertheless it's a great analog control over zoom.
Holding a certain key and doing the mouse motion, is that possible ?
|
|
|
09-15-2009, 06:32 AM
|
#3
|
Code Monkey
Join Date: Sep 2007
Location: Madison, WI
Posts: 857
|
Quote:
Originally Posted by boreg
However, there is a problem - the zoom is not centered around the current position, which "runs away" (especially noticeable when zooming in). The adjustZoom() SDK function has "centermode" parameter, but I couldn't find a magic value to make it work properly (well, I tried -1, 0 and 1 )
|
centermode values: -1 = mode set in preferences, 0 = edit or play cursor, 1 = edit cursor, 2 = center of view, 3 = mouse cursor. Maybe try 2? Let me know if you still have troubles and I can post some code to reposition the horizontal position as you please.
Quote:
- It would be great to implement drag zoom in the MIDI editor as well, but I'm not sure if it's possible.
|
I don't believe this is possible to do
You should lock the time selection / loop points with the locking system before calling adjust zoom, that will solve your problem. You need to use some undocumented stuff for this, let me dig it up and I'll post later.
|
|
|
09-15-2009, 07:42 AM
|
#4
|
Code Monkey
Join Date: Sep 2007
Location: Madison, WI
Posts: 857
|
Ok, there's a Reaper config variable "projsellock" that is a bitmask of locking parameters:
1 = Time selection
2 = Items (full)
4 = Envelopes
8 = Markers
16 = Regions
32 = Time signature markers
64 = Items (left/right)
128 = Items (up/down)
256 = Item edges
512 = Item controls
1024 = Loop points
16384 = Locking enabled
For Reaper 3.x, use the new project variable functions:
Code:
typedef void ReaProject;
REAPER_PLUGIN_DECLARE_APIFUNCS int (*projectconfig_var_getoffs)(const char* name, int* szout);
REAPER_PLUGIN_DECLARE_APIFUNCS void* (*projectconfig_var_addr)(ReaProject* proj, int idx);
You'll want to save the current lock state, do your zooming, then restore the state. Here's how:
Code:
int szout;
int* pLock = (int*)projectconfig_var_addr(NULL, projectconfig_var_getoffs("projsellock", &szout));
int savedLock = *pLock;
*pLock = 17409;
// ZOOM
*pLock = savedLock;
Good luck!
|
|
|
09-15-2009, 10:35 AM
|
#5
|
Human being with feelings
Join Date: Nov 2007
Location: Massachusetts, USA
Posts: 2,248
|
Cool...hope you can lock the time change.
|
|
|
09-15-2009, 03:22 PM
|
#6
|
Human being with feelings
Join Date: Jul 2009
Posts: 126
|
Thank you very much boreg!
It`s really neat but if you could lock the time-loop change and make it little more sluggish or inert would be great!
|
|
|
09-17-2009, 02:24 AM
|
#7
|
Human being with feelings
Join Date: Jul 2009
Posts: 162
|
Thanks for the comments folks! keep 'em coming
SWS, you're a real guru.
Will definitely have a look at this.
|
|
|
09-17-2009, 08:41 AM
|
#8
|
Human being with feelings
Join Date: Jul 2009
Posts: 162
|
Quote:
Originally Posted by sws
centermode values: -1 = mode set in preferences, 0 = edit or play cursor, 1 = edit cursor, 2 = center of view, 3 = mouse cursor. Maybe try 2? Let me know if you still have troubles and I can post some code to reposition the horizontal position as you please.
|
centermode=2 didn't help either. Actually, it doesn't appear to have any effect at all - the view always "runs away" when zooming in upper half, and stays centered around the cursor in the lower half.
Quote:
Originally Posted by denmla
It`s really neat but if you could lock the time-loop change and make it little more sluggish or inert would be great!
|
You can make it zoom slower by decreasing the "scaling" parameter in the config dialog. Default is 0.1 - try 0.05 or 0.02 and tell me if it's better.
Now, if you mean some kind of acceleration - that would be much trickier to do...
Quote:
Originally Posted by airon
Holding a certain key and doing the mouse motion, is that possible ?
|
Do you mean holding a key and dragging, or holding a key and moving the mouse (without pressing the mouse button)?
Attached is an updated version which implements SWS suggestions for locking the selection. Enjoy, and let me know what you think!
Boris.
|
|
|
11-05-2009, 12:14 PM
|
#9
|
Human being with feelings
Join Date: Sep 2008
Location: Sweden
Posts: 7,511
|
Great plug for zooming on a laptop without a scroll wheel mouse. And the difference between dragging in the "upper half" and teh "lower half" works well when you get used to it.
Thanks
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
|
|
|
08-15-2010, 06:40 PM
|
#10
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,299
|
Not perfect...but I'm surprised.
I wouldn't even dream that it is possible to do it with extensions
hope that you will update it.
Thanks a lot!
|
|
|
08-15-2010, 07:01 PM
|
#11
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,299
|
a thing I don't like is when you need to drag the mouse up and leave it again and again to zoom out because the screen limit.
[img]http://img824.**************/img824/9745/lim.gif[/img]
|
|
|
08-15-2010, 07:06 PM
|
#12
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,072
|
Same here, waiting on this one! Also it seems like that if this plugin functions to do something like this from the timeline, that one could be written to do this. I'm not a coder, so I do know.
Thanks, Wyatt
|
|
|
08-16-2010, 12:17 PM
|
#13
|
Human being with feelings
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
|
Nice work most appreciated
It would be great to be able to use this from a modifier so as to be able to hover the cursor over a part of a waveform an zoom in / out
|
|
|
08-17-2010, 03:26 AM
|
#14
|
Human being with feelings
Join Date: Jul 2009
Posts: 162
|
Thanks for the feedback folks!
Hope I'll find the time to update the plugin.
@Reflected - I agree, it's a problem, but how do you see it solved?
I was thinking of separate scaling factors for upward and downward movement - this would allow you to make zoom out faster than zoom in. Would this help?
|
|
|
08-17-2010, 09:13 AM
|
#15
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,299
|
Quote:
Originally Posted by boreg
@Reflected - I agree, it's a problem, but how do you see it solved?
I was thinking of separate scaling factors for upward and downward movement - this would allow you to make zoom out faster than zoom in. Would this help?
|
if it will work faster it may confuse the sense of balance.
not sure if you can do that from your side, but I think that limiting the mouse dragging area to a vertical area 2cm above the timeline could work well, so everytime you go to the end of the screen while dragging, it will get back to the timeline area automatically while you keep dragging up.
|
|
|
08-17-2010, 09:27 AM
|
#16
|
Human being with feelings
Join Date: Jun 2006
Location: UK
Posts: 3,239
|
Woe!!!
Interesting extension!!
hope you find the time to make it what it can be
Thanks
Subz
|
|
|
09-26-2010, 07:50 PM
|
#17
|
Human being with feelings
Join Date: Jan 2008
Location: Vancouver, BC
Posts: 3,835
|
Wow, I forgot how amazing drag-zoom is (especially on a laptop)! I really hope this is a native feature soon.
Btw, has anyone figured out a way to use this without it changing the play cursor and loop points?
__________________
FRs: v5 Media Explorer Requests, Global Quantization, Session View
Win10 Pro 64-bit, Reaper 6(x64), AMD 3950x, Aorus X570 Master, 64GB DDR4 3600, PowerColor Red Devil 5700XT, EVO 970 2TB, 10TB HD, Define R6
|
|
|
04-11-2011, 01:14 PM
|
#18
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,299
|
any updates?
maybe it will be a good idea to use middle button at the time ruler to drag zoom instead of left click, this way there will be less conflicts with the time selection.
|
|
|
04-13-2011, 03:53 AM
|
#19
|
Human being with feelings
Join Date: Jul 2009
Posts: 162
|
Sorry man, don't know when I'll have the time for it. I'll be happy to share the code (which is very simple btw) if anyone wants to take over.
|
|
|
04-13-2011, 06:17 AM
|
#20
|
Code Monkey
Join Date: Sep 2007
Location: Madison, WI
Posts: 857
|
Boreg, I can integrate your code into SWS if you're OK with that.
Tim
Last edited by sws; 04-13-2011 at 06:56 AM.
Reason: spam prevention
|
|
|
04-13-2011, 06:47 AM
|
#21
|
Human being with feelings
Join Date: Jul 2009
Posts: 162
|
Tim, that would be great!
Email sent.
|
|
|
04-13-2011, 07:05 AM
|
#22
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,072
|
Wow,
Can't wait for this one.
|
|
|
04-17-2011, 03:25 AM
|
#23
|
Human being with feelings
Join Date: Jul 2009
Location: Afford Slaughterhouse, FL
Posts: 624
|
Any updates on using this inside the MIDI editor?
__________________
It takes an ordered complex system to recognize another ordered complex system.
|
|
|
04-17-2011, 03:49 AM
|
#24
|
Human being with feelings
Join Date: Jul 2009
Posts: 162
|
Quote:
Originally Posted by pbk
Any updates on using this inside the MIDI editor?
|
AFAIK Reaper currently does not provide a function for setting zoom level in the MIDI editor. Dunno if the upcoming V4 is going to have one - if not, guess we're out of luck...
|
|
|
05-17-2011, 07:18 AM
|
#25
|
Code Monkey
Join Date: Sep 2007
Location: Madison, WI
Posts: 857
|
SWS beta #23 has Boreg's dragzoom code merged!
(Also, a confirmation that MIDI editor drag zoom is unlikely.)
|
|
|
05-17-2011, 08:02 AM
|
#26
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,072
|
Quote:
Originally Posted by sws
SWS beta #23 has Boreg's dragzoom code merged!
|
Nice Tim and Boreg. Thanks!
|
|
|
05-17-2011, 10:30 AM
|
#27
|
Human being with feelings
Join Date: Jun 2009
Location: South, UK
Posts: 14,254
|
Indeed thanks to both of you!
Apart from a few little reported bugs it's super smooth compared to most other daws!
|
|
|
05-17-2011, 11:07 AM
|
#28
|
Human being with feelings
Join Date: Oct 2006
Location: Greece
Posts: 3,554
|
Thank you very much for this!
And a reminder for the FR for this feature
http://forum.cockos.com/project.php?issueid=1723
Please vote those who are interested!
|
|
|
05-17-2011, 12:33 PM
|
#29
|
Human being with feelings
Join Date: Aug 2006
Location: Berlin
Posts: 11,839
|
Hmm. That's a great idea I had not voted on yet.I use Live as well, so I'd like something like that. I'd probably use it in the timeruler mouse modifier context .
Thanks for the plugin udpate. Fine indeed.
|
|
|
05-17-2011, 02:02 PM
|
#30
|
Human being with feelings
Join Date: Aug 2007
Location: East London
Posts: 1,719
|
Completely fantastic. Thank you.
This would be great for a "set such and such a mouse modifier action to marquee zoom" type action just like the brilliant one for freehand draw envelopes.
|
|
|
08-04-2022, 05:13 PM
|
#31
|
Human being with feelings
Join Date: Aug 2022
Posts: 13
|
Quote:
Originally Posted by Reflected
any updates?
maybe it will be a good idea to use middle button at the time ruler to drag zoom instead of left click, this way there will be less conflicts with the time selection.
|
I've got the same problem. Zooming by clicking on time selection could be very useful, but in this way it comes in conflict with changing loop selection. Changing from left click to middle click could be a good solution.
It's strange that we are only two to request for this
Last edited by tabache; 08-05-2022 at 06:51 AM.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:29 AM.
|