|
|
|
05-13-2018, 03:30 PM
|
#1
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Width & height of arrange view?
Hello!
I've haven't coded anything for some time and feel a bit rusty...
Could you tell me how to get the current width & height of the arrange view in pixels?
Thanks!
|
|
|
05-13-2018, 08:56 PM
|
#2
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
You can read these values from the reaper.ini by reading the widths of the dockers(I don't know which reaper.ini-entry is which, but it should be possible to find out).
They are updated, when you move the docker-positions, so you have always the most recent one in the reaper.ini
With that, you can calculate the width and height of the arrange-view.
|
|
|
05-14-2018, 02:39 AM
|
#3
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Thanks!
Hmm, sounds quite complicated.. :/
How can I know which docker is which and where it is located? Furthermore, if I drag a docker and change its size, is this reflected immediately in the ini?
|
|
|
05-14-2018, 02:30 PM
|
#4
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
In the SWS there is "SWS/wol: Set selected envelope height to maximum", which means that there is a way to know the arrange window height.
So, I had a look in the SWS GitHub and found this:
Code:
int GetCurrentTcpMaxHeight()
{
RECT r;
GetClientRect(GetArrangeWnd(), &r);
return r.bottom - r.top;
}
I wonder if someone could create and add in the SWS an API that would give the arrange width and height.
|
|
|
05-14-2018, 10:34 PM
|
#5
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
We have from reascript a SWS BR function to get Arrange View width as time position, and native function for zoom level.
I dont remember anything with getting with and height of arrange view right as pixels on screen.
--
Open a SWS github ticket if you want this function to be bring to reascript. :P
|
|
|
05-16-2018, 06:17 AM
|
#6
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
I built my own version of SWS where I added this:
Code:
C: void AM_GetArrangeSize(int* WidthOut, int* HeightOut)
EEL: extension_api("AM_GetArrangeSize", int &Width, int &Height)
Lua: number Width, number Height = reaper.AM_GetArrangeSize()
Python: (Int WidthOut, Int HeightOut) = AM_GetArrangeSize(WidthOut, HeightOut)
Get dimensions of Arrange View in pixels
I have done a pull request to the SWS Github too.
Works like a dream
P.S. Now is time to refine my private Smart Zoom script (and make it public when SWS adds my function)
|
|
|
05-16-2018, 09:45 AM
|
#7
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
Nice :P
|
|
|
05-16-2018, 01:22 PM
|
#9
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by doppelganger
hmm, interesting, is it possible to get current arrange view position in relation to absolute height of arrange view? Something like GetSet_ArrangeView2, but vertically with pixels at output (ideally i need x and y of track in TCP), i'm novice in programming, but maybe i will be able to do it, if it's possible in sws. I made fxlist for TCP, main functionality works, but some things, like scrolling tracks or dragging arrange view, do not work. https://stash.reaper.fm/33575/list.gif
|
What do you mean by "current arrange view position in relation to absolute height of arrange view"? The mouse pointer height in relation to the height of the arrange view?
|
|
|
05-18-2018, 02:57 PM
|
#10
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by doppelganger
that arrange area's vertical size increases, when more tracks added, right?
|
Well, no! :P The Arrange View is this:
The TCP is where track panels exist. The height of the TCP is equal to the height of the Arrange View.
I can't understand what you are trying to do, but if you wish, I can send you my sws build for you to try my function and see if that helps you
|
|
|
05-19-2018, 05:14 AM
|
#11
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
You may also be interested in my script, that displays changed and altered settings in pref-files like reaper.ini
http://mespotine.de/Ultraschall/Reap...le-Entries.lua
Just start it and drag around the elements surrounding the arrangeview to see, which elements are necessary to read from reaper.ini.
Probably the following reaper.ini-entries are interesting for you, as they surround the arrange-view exactly and are updated as soon as the these things are changed by mouse-dragging, etc.
[REAPER] -> leftpanewid - right side of TrackControlPanel
[REAPER] -> toppane - top of the first track but below the ruler
[REAPER] -> dockheight_r - docker right
[REAPER] -> dockheight_t - docker top
[REAPER] -> dockheight - docker bottom
[REAPER] -> dockheight_l - docker left
They give you the coordinates related to the Reaper-window itself, but not in relation to the screen-position.
Means, if the Reaper-window is maximized/fullscreen, the corrdinates match screencoordinates, but if you move the Reaper-window somewhere else, the coordinates don't match.
Maybe this helps you to make it work...
|
|
|
05-24-2018, 02:21 AM
|
#12
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Very cool script! Thank you mespotine!
|
|
|
05-24-2018, 03:25 AM
|
#13
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
I have this:
reaper window height = 1040
arrange view height = 749 (1040-749 = 291)
dockheight = 270
dockheight_t = 68
toppane = 68
=======================
reaper window width = 1920
arrange view width = 1460 (1920-1460 = 460)
dockheight_l = 72
dockheight_r = 348
leftpanewid = 354
I cannot get to these numbers (291 for height and 460 for width) by using any of the variables in the reaper.ini ...
Last edited by amagalma; 05-24-2018 at 04:04 PM.
|
|
|
05-24-2018, 09:03 AM
|
#14
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Unfortunately you can't influence the variables from within Reaper, only get them from reaper.ini.
|
|
|
05-24-2018, 09:22 AM
|
#15
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
I meant I cannot find a way to calculate the Arrange view height and width, without using my sws function
|
|
|
05-24-2018, 09:41 AM
|
#16
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
arrange view width = 1460 (1920-460 = 460)
|
Didn't you mean
arrange view width = 1460 (1920- 1460 = 460) ?
|
|
|
05-24-2018, 04:03 PM
|
#17
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
I know that the arrange width is 1460 pixels (through my sws api AM_GetArrangeSize.
I know that the reaper window width is 1920 pixels.
So they differ by 460 pixels (1920-460).
But dockheight_l = 72, dockheight_r = 348 and leftpanewid = 354. Not 460
|
|
|
05-24-2018, 04:04 PM
|
#18
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by mespotine
Didn't you mean
arrange view width = 1460 (1920-1460 = 460) ?
|
Yes, corrected
|
|
|
10-01-2018, 03:09 AM
|
#19
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
How would you get TCP width ?
I'm trying
Code:
a = reaper.SNM_GetIntConfigVar( "leftpanewid", 666 )
but only get the error code :S
|
|
|
10-01-2018, 07:37 AM
|
#20
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
I don't remember leftpanewid being accessible as config var. Is it in my docs?
Not all entries in reaper.ini are accessible configvars.
Maybe a good FR..
|
|
|
10-01-2018, 07:45 AM
|
#21
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Me being stupid: just read it from the reaper.ini
It will be updated when the arrangeview is updated.
There should be a script in Reaper Internals showing updated reaper.ini values. Might be helpful...
|
|
|
10-01-2018, 09:37 AM
|
#22
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
@ mespotine
I'm not sure to understand, is it a bug or just the wrong funciton to get this value then ?
I need it in a defer script so I don't think that the get private string from SWS function is the most optimized way to get it... is it ?
|
|
|
10-02-2018, 07:14 AM
|
#23
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
It's not a bug, it's just not accessible as config-var.
But you can read it from reaper.ini, where the entry is updated every time the width of the TCP is changed by the user.
So the GetPrivateProfileString-SWS-function is the only option for you, as far as I know.
Edit: You can use:
https://github.com/Ultraschall/ultra...le-Entries.lua
to display changed entries in a config-ini-file into the ReaperConsole. This might help, if you want to check, which entry has been changed, when moving around things in the arrange-view.
Last edited by Meo-Ada Mespotine; 10-02-2018 at 08:15 AM.
|
|
|
10-04-2018, 01:44 PM
|
#24
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by X-Raym
How would you get TCP width ?
|
I have created an API in SWS for that (AM_GetArrangeSize)... Hopefully, one day Tim will compile the new version of SWS..
|
|
|
10-04-2018, 02:05 PM
|
#25
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
@amalgama
Oh yes I saw that ! waiting for the merge... :P
|
|
|
10-28-2018, 03:56 AM
|
#26
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
No need to wait for the SWS merge anymore!
With juliansader's js_ReaScriptAPI extension I can get the values like this:
Code:
local w = reaper.JS_Window_Find( "trackview", true )
local retval, left, top, right, bottom = reaper.JS_Window_GetClientRect( w )
width = right - left
height = bottom - top
|
|
|
10-28-2018, 03:12 PM
|
#27
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
@amalgama
Thx !
|
|
|
11-13-2018, 06:00 AM
|
#28
|
Human being with feelings
Join Date: Dec 2015
Location: Guangzhou, China
Posts: 176
|
Quote:
Originally Posted by amagalma
No need to wait for the SWS merge anymore!
With juliansader's js_ReaScriptAPI extension I can get the values like this:
Code:
local w = reaper.JS_Window_Find( "trackview", true )
local retval, left, top, right, bottom = reaper.JS_Window_GetClientRect( w )
width = right - left
height = bottom - top
|
How to access the function "JS_Window_Find" in Lua?
|
|
|
11-13-2018, 07:03 AM
|
#29
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
|
|
|
12-15-2018, 09:57 AM
|
#30
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
@amalgama
Really awesome !!
|
|
|
12-16-2018, 03:38 AM
|
#31
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Impressive!
|
|
|
12-21-2018, 02:11 PM
|
#32
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Alternative method (using julian's v0.962):
Code:
local _, left, top, right, bottom = reaper.JS_Window_GetClientRect( reaper.JS_Window_FindChildByID( reaper.GetMainHwnd(), 1000) )
width = right - left
height = bottom - top
|
|
|
12-21-2018, 03:08 PM
|
#33
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
@amagalma
How is it better ?
|
|
|
12-21-2018, 07:11 PM
|
#34
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
I remember julian saying that finding a window by name is not the safest cross-platform way, since windows may have different names on different platforms (or no names). Finding by ID is the way to go
|
|
|
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:59 AM.
|