Old 10-19-2019, 12:13 AM   #1
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default API Request: reaper.GetSet_VerticalArrangeView()

Humbly requesting to the REAPER lords an API function that allows retrieving/declaring of the arrange view's vertical position and zoom, in pixels.

Also, an API function that allows get/set of arrange view vertical scroll.

Identical, in fact, to REAPER's reaper.GetSet_ArrangeView2(), except that it would affect/retrieve the vertical of the arrange window, and that it would be pixel-based (for obvious reasons).

Last edited by Dafarkias; 10-24-2019 at 08:36 AM.
Dafarkias is offline   Reply With Quote
Old 10-19-2019, 08:11 AM   #2
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,527
Default

Quote:
Originally Posted by Dafarkias View Post
Also, an API function that allows get/set of arrange view vertical scroll.
In the meantime you could use js_ReaScriptAPI extension, JS_Window_Get/SetScrollInfo, for example...
Code:
  arrangeview = reaper.JS_Window_FindChildByID(reaper.GetMainHwnd(), 1000)
  retval, position, pageSize, min, max, trackPos = reaper.JS_Window_GetScrollInfo(arrangeview, "SB_VERT")
  reaper.JS_Window_SetScrollPos(arrangeview, "SB_VERT", position + 100) -- scroll down 100 pixels

Last edited by Edgemeal; 10-19-2019 at 08:37 AM. Reason: Add link to Julian's thread
Edgemeal is offline   Reply With Quote
Old 10-19-2019, 03:27 PM   #3
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default

@Edgemeal

Thanks!

Actually that is what I'm currently using for the new script I'm working on. It's a wip, but I'm trying to create a project map. Scalable, and used to quickly jump to any project location with just a click.

https://forum.cockos.com/showthread.php?t=226263

Last edited by Dafarkias; 10-20-2019 at 04:41 AM.
Dafarkias is offline   Reply With Quote
Old 10-21-2019, 10:04 AM   #4
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default

Bump. Essentially I've found it impossible to create my rmb marquee portion of my project map script, even when using Julian's extension.

[edit]

Okay, maybe not impossible but it's a very clunky workaround.

Last edited by Dafarkias; 10-21-2019 at 10:33 PM.
Dafarkias is offline   Reply With Quote
Old 10-24-2019, 04:37 AM   #5
Nantho
Human being with feelings
 
Join Date: Mar 2013
Posts: 131
Default

+1 because I'm in love with Dafarkias new script and it will make it more powerful
Nantho is online now   Reply With Quote
Old 10-24-2019, 05:08 AM   #6
Sumalc
Human being with feelings
 
Join Date: Oct 2009
Location: France
Posts: 566
Default

+1

thank you.
Sumalc is offline   Reply With Quote
Old 10-25-2019, 12:03 AM   #7
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default

Thanks for the support!

It would be nice to have some acknowledgement from the devs that this thread exists... E.g., we don't have time for this at the moment, or there are logistical limitations that would prevent us from incorporating such an API function...
Dafarkias is offline   Reply With Quote
Old 10-25-2019, 06:03 AM   #8
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,475
Default

Quote:
Originally Posted by Dafarkias View Post
Thanks for the support!

It would be nice to have some acknowledgement from the devs that this thread exists... E.g., we don't have time for this at the moment, or there are logistical limitations that would prevent us from incorporating such an API function...
I've been on this forum for ten years and I can probably count on one hand the number of times I've seen that happen.
Lokasenna is offline   Reply With Quote
Old 10-25-2019, 11:03 AM   #9
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default

Fingers crossed. This may just be the (1>x<5)+1 occurrence. :P

jk.
Dafarkias is offline   Reply With Quote
Old 11-03-2019, 12:58 AM   #10
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default

Buuu-uuuummp?
Dafarkias is offline   Reply With Quote
Old 11-14-2019, 05:26 AM   #11
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default

A shameless bump.

One day, the devs will give in to my insufferable persistence lol

This feature, I feel, will open up doors for graphic scripts that can more heavily optimize zooming and track management workflows. This excites me, as I love being able to 'custom script' workflow utilities via a near seamless integration.

I don't know if m/any other DAWs provide such similar capability.
Dafarkias is offline   Reply With Quote
Old 11-20-2019, 12:01 PM   #12
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default

I've decided not to bump this thread anymore.

I've given up on the idea that scripters (I'm not a scripter, I'm too bad at it) should be able to manually adjust and set the virtual zoom of the arrange view.

It would cause havoc!

Think about it! All the various scripters being able to assign vertical view positioning all willy-nilly? The sheer thought of it makes me laugh.

Last edited by Dafarkias; 11-20-2019 at 12:10 PM.
Dafarkias is offline   Reply With Quote
Old 11-20-2019, 12:04 PM   #13
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,475
Default

Quote:
Originally Posted by Dafarkias View Post
Think about it! All the various scripters being able to assign vertical view positioning willy-nilly? The sheer thought of it makes me laugh.
That's only a problem if someone has more than one script running that affects the zoom/scroll state; that's a user issue.

I'm still firmly a +1 to this FR, because if I have a script that manipulates the visible tracks, their heights, whatever, I should damn well be able to make sure that user is looking at the intended track afterward.
Lokasenna is offline   Reply With Quote
Old 11-20-2019, 12:09 PM   #14
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default

I must shamefully admit that I was being facetious with ^^^ that post.

I realize that sarcasm is the lowest form of wit, but it's all I have...
Dafarkias is offline   Reply With Quote
Old 11-23-2019, 12:34 PM   #15
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 305
Default

Found a work-around (I think?) for setting vertical zoom and positioning using existing REAPER API functions...

If you're interesting let me know, please. I've attempted to use the workaround in my v.093 Project Map Nav. script.

[Edit]

When I look back at the code, it looks as if I did use two of Julian's functions to make my workaround, reaper.JS_Window_GetClientSize, and reaper.JS_Window_GetScrollInfo.

It's a really ugly work around, but it's loosely based on this code:

Code:
reaper.CSurf_OnScroll( 0, math.floor((reaper.GetMediaTrackInfo_Value( reaper.GetTrack( 0, 0 ), "I_WNDH" )/8)+.5) )
It seems as if when REAPER zooms, the reaper.CSurf_OnScroll 'follows' it by a division of 8. What makes it tricky is that (I believe) it accounts for the 'gray space' at the bottom of your last track in the arrange view, meaning it isn't a truly relevant conversion until you use Julian's functions to calculate the 'gray space'.

So basically, you could attempt to:
  • save each tracks' height into a table, and the combined total in a variable
  • calculate 'gray space' by comparing total vertical height of all tracks to the arrange view height using reaper.JS_Window_GetClientSize
  • create a ratio using these variables/tables, and set/multiply each track's height accordingly using the "I_HEIGHTOVERRIDE" parameter from reaper.SetMediaTrackInfo_Value
Zoom is complete...
  • use reaper.CSurf_OnScroll( 0, -100000 ) to vertically scroll to the top of the arrange
  • using your corrected ratios, utilize reaper.CSurf_OnScroll again with a division of '8' to set your scroll accordingly.
Scroll is complete...

It's a huge pain in the butt, and definitely should be added natively to the API!

Last edited by Dafarkias; 11-23-2019 at 11:08 PM.
Dafarkias 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 06:49 AM.


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