|
|
|
02-27-2020, 01:28 PM
|
#961
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by cohler
js_ReaScriptAPI appears to be broken by Reaper 6.04. Various calls have stopped working.
Anybody know anything about this?
|
Could you please give more details about your DAW and the problems you are seeing? Which calls have stopped working?
(The functions that I have tested still seem to be working fine on my Window x64 system, with REAPER v6.04 and extension v0.999.)
|
|
|
02-27-2020, 05:02 PM
|
#962
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by juliansader
Try:
Code:
local r, g, b = reaper.ColorFromNative(reaper.GetTrackColor(track))
color_for_LICE = 0xFF000000 | (r<<16) | (g<<8) | b
|
Works great, Thanks!
|
|
|
02-28-2020, 08:20 AM
|
#963
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by juliansader
Could you please give more details about your DAW and the problems you are seeing? Which calls have stopped working?
(The functions that I have tested still seem to be working fine on my Window x64 system, with REAPER v6.04 and extension v0.999.)
|
reaper.JS_Window_GetTitle doesn't work on REAPER 6.04 on Mac OS X 10.12 running v0.998 of your software.
But it does work on REAPER 6.03.
|
|
|
02-28-2020, 08:22 AM
|
#964
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,622
|
Could you try again with version 0.999, which is the latest?
|
|
|
02-28-2020, 08:26 AM
|
#965
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by juliansader
Could you please give more details about your DAW and the problems you are seeing? Which calls have stopped working?
(The functions that I have tested still seem to be working fine on my Window x64 system, with REAPER v6.04 and extension v0.999.)
|
By the way, is there any way in your software to find out which windows are docked in which docks, and then to find the current height of dock in the Main window? I've been searching for a few hours now and haven't found anything that can do that. What am I missing?
|
|
|
02-28-2020, 08:44 AM
|
#966
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,622
|
No there isn't. The docking of windows is still an area full of feature requests.
You can support my feature-request for more docker-related functions:
https://forum.cockos.com/showthread....ghlight=docker
This could help, maybe.
|
|
|
02-28-2020, 10:31 AM
|
#967
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by cohler
By the way, is there any way in your software to find out which windows are docked in which docks, and then to find the current height of dock in the Main window? I've been searching for a few hours now and haven't found anything that can do that. What am I missing?
|
Docked windows are a hassle, as discussed in this, this and this thread. I haven't tried this myself, but off the top of my head the native function DockIsChildOfDock can perhaps help you find out which windows are docked in which docks, the extension's GetParent can then find the dock, and the GetRect functions can give the height of the dock.
|
|
|
02-28-2020, 05:28 PM
|
#968
|
Banned
Join Date: Dec 2018
Posts: 642
|
How about Scrolling on Mac?
JS_Window_SetScroll and JS_Window_GetScroll don't seem to work at all on Mac (at least for the main HWND; I haven't tried it on other windows).
CSurf_OnScroll seems to work but it allows scrolling only in increments of 8 pixels.
Any solution for this?
|
|
|
02-29-2020, 11:50 AM
|
#969
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
@ juliansader,
For JS_Composite() docs says, "If dstw or dsth is -1, the bitmap will be stretched to fill the width or height of the window", but using -1 doesn't work. Finally googled the function name and found a script by Sexan and noticed he's using 1,1 for these params. So I tried 1,1 instead of -1,-1 and now my code is working as expected.
Maybe its just me but the docs seems confusing, shouldn't it say, "If dstw or dsth are 1" (a positive one) instead of -1, or the API function in the extension needs updating?
Last edited by Edgemeal; 02-29-2020 at 12:17 PM.
|
|
|
02-29-2020, 12:25 PM
|
#970
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
It should definitely be "-1". Sexan uses "1" for the srcw and srch, because his source bitmaps are only single pixels.
I don't think he ever uses the dstw = -1 or dsth = -1 options, because the Area51 selections don't cover the whole destination window.
Last edited by juliansader; 02-29-2020 at 12:54 PM.
|
|
|
02-29-2020, 12:50 PM
|
#971
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by cohler
JS_Window_SetScroll and JS_Window_GetScroll don't seem to work at all on Mac (at least for the main HWND; I haven't tried it on other windows).
CSurf_OnScroll seems to work but it allows scrolling only in increments of 8 pixels.
Any solution for this?
|
I quickly checked the scrolling functions on my High Sierra x64, REAPER v6.04, and they seem to work fine on my system. Please check the following:
* To scroll a child window, you must pass the HWND of that child window, not the parent window. In your case, I assume that you are trying to scroll the arrange view, which is a child window with ID = 1000, IIRC.
* REAPER doesn't like scrolling outside the boundaries of the project, so if the script tries to do that with the SetScrollPos function, REAPER will ignore the request.
(N.B: The scrolling functions can only politely request a window to scroll, and it is up to the window to accept the request or not.)
|
|
|
02-29-2020, 03:56 PM
|
#972
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by juliansader
I quickly checked the scrolling functions on my High Sierra x64, REAPER v6.04, and they seem to work fine on my system. Please check the following:
* To scroll a child window, you must pass the HWND of that child window, not the parent window. In your case, I assume that you are trying to scroll the arrange view, which is a child window with ID = 1000, IIRC.
|
Great, thank you! That solved the problem. Is there a spec somewhere, that lists the standard IDs of the various child windows of the MainHwnd? GetLongPtr doesn't actually return any long integer pointers. It only apparently returns Userdata which can't be accessed in Lua. Or is there another way to get the integer IDs of windows?
|
|
|
02-29-2020, 04:52 PM
|
#973
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by cohler
Great, thank you! That solved the problem. Is there a spec somewhere, that lists the standard IDs of the various child windows of the MainHwnd? GetLongPtr doesn't actually return any long integer pointers. It only apparently returns Userdata which can't be accessed in Lua. Or is there another way to get the integer IDs of windows?
|
I figured it out. GetLong (not GetLongPtr) returns integers with parameter "ID".
|
|
|
03-01-2020, 11:29 AM
|
#974
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by juliansader
It should definitely be "-1". Sexan uses "1" for the srcw and srch, because his source bitmaps are only single pixels.
|
Thanks for the reply, changed some code around and I think things are starting to sink in! Sorry to be a bother!
|
|
|
03-03-2020, 11:11 AM
|
#975
|
Human being with feelings
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
|
Dear JS:
I'm thinking about trying my own attempt at an area selection script using your extension.
Would you by chance know if the following functions work cross-platform?
SetStyle(specifically for "POPUP"), SetOpacity("ALPHA"), and GetClientRect.
My fuzzy idea to get the script working is to overlay a transparent window over the arrange view window of REAPER, in order to intercept mouse action, intercept key presses (if necessary), and draw graphics.
|
|
|
03-03-2020, 11:57 AM
|
#976
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
All three of these functions are supposed to work cross-platform -- unless REAPER v6.0's new Metal graphics messed up SetStyle and SetOpacity.
Writing a new AS script would be a horrendously big undertaking. Perhaps you should rather build on Sexan's code? (He actually pleaded for other scripters to get involved.)
|
|
|
03-03-2020, 12:35 PM
|
#977
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Or maybe just wait for REAPER 6.1 in the hope that area selection will make it lit? I don't want to discourage you, but area selection is something that needs to be weaved so deeply into REAPER, that I don't think a script will be easy to maintain on the long run.
|
|
|
03-03-2020, 01:16 PM
|
#978
|
Human being with feelings
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
|
It's just a wild hair.
If my enthusiasm fizzes out or I hit an impasse, no harm no foul...
|
|
|
03-05-2020, 05:00 AM
|
#979
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,180
|
I just used this API to make a command that opens the video window in the spot where the main toolbar is above the TCP.
I'm on mac and I can't get the video window to be frameless with no titlebar using "POPUP". Is this possible, even ?
Here's my code can anyone help?
Code:
V_win = reaper.JS_Window_Find("Video Window ", false )
if not V_win then
reaper.Main_OnCommand(50125, 0) -- toggle video window
Video = reaper.JS_Window_FindTop( 'Video Window', 1 )
retval, ZOrder, flags = reaper.JS_Window_SetPosition( Video, 0, 884, 187, 148, TOPMOST, POPUP )
-- retval, style = reaper.JS_Window_SetStyle( Video, POPUP )
end
|
|
|
03-05-2020, 11:09 AM
|
#980
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Triode
I'm on mac and I can't get the video window to be frameless with no titlebar using "POPUP". Is this possible, even ?
|
"POPUP" should be a string with quotation marks, not just POPUP.
|
|
|
03-05-2020, 11:27 AM
|
#981
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,180
|
Thanks!
FYI that works with reaper.JS_Window_SetStyle
but not reaper.JS_Window_SetStyle
as far as I can tell
|
|
|
03-14-2020, 07:27 PM
|
#982
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,622
|
Quote:
Originally Posted by Triode
Thanks!
FYI that works with reaper.JS_Window_SetStyle
but not reaper.JS_Window_SetStyle
as far as I can tell
|
It works with the function, with which it doesn't work? Hmmm....
|
|
|
03-15-2020, 01:57 PM
|
#983
|
Banned
Join Date: Dec 2018
Posts: 642
|
Dimmed menu items
Are there any functions in your ReaScript extension (or is there another method) wherein one could create Reaper menu items that would be greyed out or not based on programmable criteria? Sorry if this has already been discussed elsewhere, but I haven't been able to find anything...
|
|
|
03-15-2020, 02:27 PM
|
#984
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,180
|
Quote:
Originally Posted by mespotine
It works with the function, with which it doesn't work? Hmmm....
|
Sorry yes that was a cut and paste error.
I meant that I couldn't get the window style to change using reaper.JS_Window_SetPosition
but I could with reaper.JS_Window_SetStyle
(I'm on mac)
|
|
|
03-17-2020, 09:05 AM
|
#985
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
"JS_Dialog_BrowseForOpenFiles" Window Title
Why can't I see the window title on this command?
Code:
reaper.JS_Dialog_BrowseForOpenFiles('title', path, '', 'filetype (.RPL)\0*.RPL\0\0', false)
For Save it works great:
Code:
reaper.JS_Dialog_BrowseForSaveFile('title', path, '', 'filetype (.RPL)\0*.RPL\0\0')
I'm on mac
|
|
|
03-17-2020, 11:20 AM
|
#986
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Why can't I see the window title on this command?
I'm on mac
|
Since El Capitan, Apple has removed custom captions from standard File Open dialogs. It is possible to "hack" captions by displaying the custom title as a message on top of the dialog, but Cockos's WDL/swell hasn't implemented this:
* macOS file open dialogs don't provide a dropdown list for the extension filter -- instead, all extensions in the list are enabled
* the "Open" button is only enabled once a file (with an acceptable extension) is selected.
|
|
|
03-17-2020, 12:12 PM
|
#987
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,622
|
Quote:
Originally Posted by cohler
Are there any functions in your ReaScript extension (or is there another method) wherein one could create Reaper menu items that would be greyed out or not based on programmable criteria? Sorry if this has already been discussed elsewhere, but I haven't been able to find anything...
|
You mean in regular menus, like File, Edit, View, etc?
|
|
|
03-17-2020, 04:13 PM
|
#988
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by mespotine
You mean in regular menus, like File, Edit, View, etc?
|
Yes the regular menus.
|
|
|
03-17-2020, 04:40 PM
|
#989
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,622
|
|
|
|
03-17-2020, 04:44 PM
|
#990
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by mespotine
|
It seems like there should be a simple way to do this. REAPER boasts of its customizable menus. And indeed, several of its internal functions grey out menu items and report various info (like last executed command etc...). It would seem like this capability would be the FIRST thing one would design into a "customizable" menu interface. But perhaps, this is just another in the long list of things that the developers forgot to do?
|
|
|
03-18-2020, 04:49 AM
|
#991
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
Well in a reascript right-click menu, titles that starts with # will be grayed out.
Dunno if it can work in regular menu.
|
|
|
03-25-2020, 11:55 AM
|
#992
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
The macOS 32-bit build fails to load due to missing symbols (_png_create_info_struct):
Code:
dlopen(reaper_js_ReaScriptAPI32.dylib, 6): Symbol not found: _png_create_info_struct
Referenced from: reaper_js_ReaScriptAPI32.dylib
Expected in: flat namespace
in reaper_js_ReaScriptAPI32.dylib
|
|
|
04-01-2020, 06:32 AM
|
#993
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,607
|
Hi Julian.
Area51 is finally working on OSX but there is one issue:
Code:
if reaper.JS_Window_GetForeground() ~= main_wnd then
return
end
This is used to prevent clicking thru windows.On windows its working as expected but on osx its not working.
On OSX when any window is opened its triggering this API call.
Code:
reaper.BR_Win32_GetForegroundWindow()
Is also affected.
Windows
Area should move as you see.
On OSX if any window is opened you cannot move it (its triggering true).
Stevie will follow up this post with OSX side
Last edited by Sexan; 04-01-2020 at 06:57 AM.
|
|
|
04-01-2020, 06:37 AM
|
#994
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Yes, I can confirm that. I've tried a simple code to retrieve the current window in OS X, but the console doesn't pop up:
|
|
|
04-01-2020, 11:41 AM
|
#995
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
I checked the WDL/swell code, and it seems that swell usually regards the foreground window and the focused window as the same thing. On OSX and Linux, therefore, the focused *child* window will also be the foreground window.
I therefore suggest that you check whether the arrange view is focused, rather than whether the main window is in the foreground.
On Windows, AFAIK, the foreground window should be the parent toplevel window of the focused child window. Am I correct?
Perhaps I can add some code to JS_Window_GetForeground on Linux/OSX to return the parent toplevel window.
Last edited by juliansader; 04-01-2020 at 11:50 AM.
|
|
|
04-01-2020, 01:40 PM
|
#996
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
I am doing my first steps in drawing with the JS_ReascriptAPI and wrote this simple test:
Code:
local start = reaper.time_precise()
local trackview = reaper.JS_Window_FindChildByID(reaper.GetMainHwnd(), 1000)
local pen = reaper.JS_GDI_CreatePen( 1, 16777215 )
local first_x = reaper.GetMousePosition()
function main()
local item = reaper.BR_ItemAtMouseCursor()
local x = reaper.GetMousePosition() -- screen
if item and x ~= first_x then
local y = reaper.GetMediaTrackInfo_Value( reaper.GetMediaItem_Track( item ), "I_TCPY" ) +
reaper.GetMediaItemInfo_Value( item, "I_LASTY" ) -- client
local height = reaper.GetMediaItemInfo_Value( item, "I_LASTH" )
x = reaper.JS_Window_ScreenToClient( trackview, x, 0 )
local hdc = reaper.JS_GDI_GetClientDC( trackview )
reaper.JS_GDI_SelectObject( hdc, pen )
reaper.JS_GDI_Line( hdc, x, y + 1, x, y + height - 2 )
reaper.JS_GDI_ReleaseDC( trackview, hdc )
first_x = x
end
local now = reaper.time_precise()
if now - start >= 10 then
reaper.ShowConsoleMsg("script ended\n\n")
reaper.JS_GDI_DeleteObject( pen )
reaper.UpdateArrange()
return
else
reaper.defer(main)
end
end
main()
Basically, it displays a line over the position of the mouse cursor when it is over an item. The problem is that it gets full of lines as I move the mouse. How can I erase them and keep only the one that is currently under the mouse pointer? Furthermore, what I wrote, is it correct? Is this the correct way to do it? Thanks!
Last edited by amagalma; 04-01-2020 at 02:32 PM.
|
|
|
04-02-2020, 04:14 AM
|
#997
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,607
|
Quote:
Originally Posted by juliansader
I checked the WDL/swell code, and it seems that swell usually regards the foreground window and the focused window as the same thing. On OSX and Linux, therefore, the focused *child* window will also be the foreground window.
I therefore suggest that you check whether the arrange view is focused, rather than whether the main window is in the foreground.
On Windows, AFAIK, the foreground window should be the parent toplevel window of the focused child window. Am I correct?
Perhaps I can add some code to JS_Window_GetForeground on Linux/OSX to return the parent toplevel window.
|
It would be nice if it can check that internally, right now I'm using workaround but not sure how good it is.
Code:
function Get_window_under_mouse()
if mouse.l_down then
local windowUnderMouse = reaper.JS_Window_FromPoint(mouse.x, mouse.y)
local old_windowUnderMouse = reaper.JS_Window_FromPoint(mouse.ox, mouse.oy)
if windowUnderMouse then
if windowUnderMouse ~= track_window then
return true
elseif old_windowUnderMouse then
if old_windowUnderMouse ~= track_window then
return true
end
end
end
end
return false
end
It returns true if some window is at top, but it needed additional checking (old_window) because it would crash on OSX if dragging from one window to another (which does not happen on Windows)
|
|
|
04-02-2020, 03:18 PM
|
#998
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Quote:
Originally Posted by amagalma
How can I erase them and keep only the one that is currently under the mouse pointer?
|
I messed around a bit and I could get it working by putting the reaper.UpdateArrange()
just below first_x = x. But it's doing a lot of flickering here in Windows.
|
|
|
04-02-2020, 04:10 PM
|
#999
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by amagalma
Basically, it displays a line over the position of the mouse cursor when it is over an item. The problem is that it gets full of lines as I move the mouse. How can I erase them and keep only the one that is currently under the mouse pointer? Furthermore, what I wrote, is it correct? Is this the correct way to do it? Thanks!
|
You can use JS_Window_InvalidateRect to ask REAPER to re-draw part of a window, which will cover up the previous cycle's line.
For example, try adding this directly after the ReleaseDC line:
Code:
if prev_x and prev_x ~= x then reaper.JS_Window_InvalidateRect(trackview, prev_x, prev_top_y, prev_x+1, prev_bottom_y, true)
prev_x, prev_top_y, prev_bottom_y = x, y+1, y+height-1
Here on my system, this works without any flickering.
Last edited by juliansader; 04-02-2020 at 10:41 PM.
|
|
|
04-02-2020, 04:14 PM
|
#1000
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Sexan
It would be nice if it can check that internally, right now I'm using workaround but not sure how good it is.
|
Checking whether the trackview is under the mouse actually seems to me to be a better solution that checking whether it is focused.
Quote:
Originally Posted by Sexan
It returns true if some window is at top, but it needed additional checking (old_window) because it would crash on OSX if dragging from one window to another (which does not happen on Windows)
|
Could you let me know what circumstances and code causes crashes on OSX?
|
|
|
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 08:55 AM.
|