Old 02-27-2020, 01:28 PM   #961
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by cohler View Post
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.)
juliansader is offline   Reply With Quote
Old 02-27-2020, 05:02 PM   #962
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by juliansader View Post
Try:
Code:
local r, g, b = reaper.ColorFromNative(reaper.GetTrackColor(track))
color_for_LICE = 0xFF000000 | (r<<16) | (g<<8) | b
Works great, Thanks!
Edgemeal is offline   Reply With Quote
Old 02-28-2020, 08:20 AM   #963
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by juliansader View Post
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.
cohler is offline   Reply With Quote
Old 02-28-2020, 08:22 AM   #964
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Could you try again with version 0.999, which is the latest?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-28-2020, 08:26 AM   #965
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by juliansader View Post
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?
cohler is offline   Reply With Quote
Old 02-28-2020, 08:44 AM   #966
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

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.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-28-2020, 10:31 AM   #967
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by cohler View Post
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.
juliansader is offline   Reply With Quote
Old 02-28-2020, 05:28 PM   #968
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default 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?
cohler is offline   Reply With Quote
Old 02-29-2020, 11:50 AM   #969
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

@ 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.
Edgemeal is offline   Reply With Quote
Old 02-29-2020, 12:25 PM   #970
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

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.
juliansader is offline   Reply With Quote
Old 02-29-2020, 12:50 PM   #971
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by cohler View Post
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.)
juliansader is offline   Reply With Quote
Old 02-29-2020, 03:56 PM   #972
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by juliansader View Post
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?
cohler is offline   Reply With Quote
Old 02-29-2020, 04:52 PM   #973
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by cohler View Post
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".
cohler is offline   Reply With Quote
Old 03-01-2020, 11:29 AM   #974
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by juliansader View Post
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!
Edgemeal is offline   Reply With Quote
Old 03-03-2020, 11:11 AM   #975
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

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.
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 03-03-2020, 11:57 AM   #976
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

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.)
juliansader is offline   Reply With Quote
Old 03-03-2020, 12:35 PM   #977
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

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.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 03-03-2020, 01:16 PM   #978
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

It's just a wild hair.

If my enthusiasm fizzes out or I hit an impasse, no harm no foul...
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 03-05-2020, 05:00 AM   #979
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

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
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 03-05-2020, 11:09 AM   #980
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Triode View Post
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.
juliansader is offline   Reply With Quote
Old 03-05-2020, 11:27 AM   #981
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

Thanks!

FYI that works with reaper.JS_Window_SetStyle
but not reaper.JS_Window_SetStyle

as far as I can tell
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 03-14-2020, 07:27 PM   #982
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by Triode View Post
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....

__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-15-2020, 01:57 PM   #983
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default 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...
cohler is offline   Reply With Quote
Old 03-15-2020, 02:27 PM   #984
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

Quote:
Originally Posted by mespotine View Post
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)
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 03-17-2020, 09:05 AM   #985
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default "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
lexaproductions is offline   Reply With Quote
Old 03-17-2020, 11:20 AM   #986
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

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.
juliansader is offline   Reply With Quote
Old 03-17-2020, 12:12 PM   #987
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by cohler View Post
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?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-17-2020, 04:13 PM   #988
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by mespotine View Post
You mean in regular menus, like File, Edit, View, etc?
Yes the regular menus.
cohler is offline   Reply With Quote
Old 03-17-2020, 04:40 PM   #989
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Ok, I doubt the regular menus are possible to set, but the c++-only part of the API has some functions, related to menus.
Maybe exposing them can help, maybe not. At least you can add customizeable menus somehow, but I never tried, as I code Lua only:

https://mespotin.uber.space/Ultrasch...stomizableMenu
https://mespotin.uber.space/Ultrasch...nsionsMainMenu
https://mespotin.uber.space/Ultrasch...stomizableMenu
https://mespotin.uber.space/Ultrasch...GetContextMenu
https://mespotin.uber.space/Ultrasch...iftSubModeMenu
https://mespotin.uber.space/Ultrasch...essActionsMenu
https://mespotin.uber.space/Ultrasch..._reprocessMenu

@julian
Would it be possible to expose them, so we can toy around with them?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-17-2020, 04:44 PM   #990
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by mespotine View Post
Ok, I doubt the regular menus are possible to set, but the c++-only part of the API has some functions, related to menus.
Maybe exposing them can help, maybe not. At least you can add customizeable menus somehow, but I never tried, as I code Lua only:

https://mespotin.uber.space/Ultrasch...stomizableMenu
https://mespotin.uber.space/Ultrasch...nsionsMainMenu
https://mespotin.uber.space/Ultrasch...stomizableMenu
https://mespotin.uber.space/Ultrasch...GetContextMenu
https://mespotin.uber.space/Ultrasch...iftSubModeMenu
https://mespotin.uber.space/Ultrasch...essActionsMenu
https://mespotin.uber.space/Ultrasch..._reprocessMenu

@julian
Would it be possible to expose them, so we can toy around with them?
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?
cohler is offline   Reply With Quote
Old 03-18-2020, 04:49 AM   #991
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

Well in a reascript right-click menu, titles that starts with # will be grayed out.
Dunno if it can work in regular menu.
lexaproductions is offline   Reply With Quote
Old 03-25-2020, 11:55 AM   #992
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

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
cfillion is offline   Reply With Quote
Old 04-01-2020, 06:32 AM   #993
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,593
Default

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.
Sexan is online now   Reply With Quote
Old 04-01-2020, 06:37 AM   #994
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

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:

__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-01-2020, 11:41 AM   #995
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

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.
juliansader is offline   Reply With Quote
Old 04-01-2020, 01:40 PM   #996
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

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!

__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 04-01-2020 at 02:32 PM.
amagalma is offline   Reply With Quote
Old 04-02-2020, 04:14 AM   #997
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,593
Default

Quote:
Originally Posted by juliansader View Post
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)
Sexan is online now   Reply With Quote
Old 04-02-2020, 03:18 PM   #998
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Quote:
Originally Posted by amagalma View Post
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.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-02-2020, 04:10 PM   #999
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by amagalma View Post
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.
juliansader is offline   Reply With Quote
Old 04-02-2020, 04:14 PM   #1000
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Sexan View Post
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 View Post
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?
juliansader 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 08:22 AM.


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