Old 09-02-2017, 12:00 PM   #1
mespotine
Human being with feelings
 
Join Date: May 2017
Posts: 25
Default API function: my_getViewport buggy?

I've tried a lot around with that function, as I hoped, it would give me control over the boundaries and position of the Reaper-Window itself.

But instead, it does nothing I can figure out of. No matter what I'm putting into the parameters, if I use them as "pointer variable" to get something(as sometimes reaperarrays work) or as a parameter so set something, it doesn't do anything I can make us of.

I'm not sure, whether this function is broken or useless, but I don't know for sure.

So, how to make it do anything? Or is it for something, no one knows? Is it working or is it buggy?
mespotine is offline   Reply With Quote
Old 09-02-2017, 04:36 PM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: The vast, frozen wasteland of western Canadia.
Posts: 4,227
Default

There's absolutely no documentation for it, that's the problem. If you google the function name you can actually find it used in a .cpp on (IIRC) Landoleet, Justin's dev server.

I've been able to do this much with it in Lua:
Code:
local _, _, w, h = reaper.my_getViewport(0, 0, 0, 0, 0, 0, 0, 0, 1)

reaper.ShowConsoleMsg("Screen width = "..tostring(w).."\nScreen height = "..tostring(h))
- The 30px missing from Height are my taskbar, I think.

- It has issues with multiple monitors.
__________________
Currently working away from home; don't expect timely responses from me.
Default 5.0 Nitpicky Edition / GUI tutorial for Lua / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate / ReaPack
Lokasenna is offline   Reply With Quote
Old 09-08-2017, 09:29 AM   #3
mespotine
Human being with feelings
 
Join Date: May 2017
Posts: 25
Default

It's a pity that it's not documented. Having the boundaries of the main Reaper-window would allow tons of cool features immediately.
Especially, as a lot of information on position of GUI-elements are stored in the reaper.ini.

I just figured out, how to do Client2Screen2Client-pixelconversion for the x-ccordinate for the main-Reaper window, yet.
The y-coordinate is still missing in my toolbox... :/
mespotine is offline   Reply With Quote
Old 09-08-2017, 07:41 PM   #4
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 10,328
Default

Quote:
Originally Posted by Lokasenna View Post
There's absolutely no documentation for it, that's the problem. If you google the function name you can actually find it used in a .cpp on (IIRC) Landoleet, Justin's dev server.

I've been able to do this much with it in Lua:
Code:
local _, _, w, h = reaper.my_getViewport(0, 0, 0, 0, 0, 0, 0, 0, 1)

reaper.ShowConsoleMsg("Screen width = "..tostring(w).."\nScreen height = "..tostring(h))
- The 30px missing from Height are my taskbar, I think.

- It has issues with multiple monitors.
Heh I don't think this was ever actually intended to be used from Lua...

Explanation:
Code:
local l, t, r, b = reaper.my_getViewport(0, 0, 0, 0, pl, pt, pr, pb, want_workspace)
returns left/top/right/bottom of viewport. If want_workspace is 0, then returns the full monitor coordinates, otherwise returns the workspace.

pl/pt/pr/pb define a rectangle which will be used for multimonitors -- it will return the viewport that that rectangle is on/closest to.
Justin is online now   Reply With Quote
Old 09-10-2017, 08:25 AM   #5
mespotine
Human being with feelings
 
Join Date: May 2017
Posts: 25
Default

@justin

thanx for the description
mespotine 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:18 AM.


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