Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Feature Requests

Reply
 
Thread Tools Display Modes
Old 10-30-2016, 09:45 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,372
Default ReaScript: Allow scripts to change mouse cursor [DONE! in extension API]

Aesthetic issues:
One of the complaints against using ReaScripts for MIDI editing is that the scripts do not look and feel as "elegant" as REAPER's native mouse modifier actions. (E.g. Reaper for Orchestral work and Display CC event through Curves instead of Bars.)

Practical issues:
It is not always obvious to the user that a deferred script is running (or which script is running), particularly if the script is not linked to a toolbar button. (E.g. CC stretching script.)

I suggest that both of these issues could be ameliorated if scripts could change the mouse cursor in REAPER's main UI, similar to how scripts can change the mouse cursor in its own GUI using gfx.setcursor.

Last edited by juliansader; 08-18-2018 at 07:27 AM.
juliansader is online now   Reply With Quote
Old 07-23-2017, 03:22 AM   #2
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,372
Default

Custom cursors can be faked by drawing a tooltip next to the cursor:

Code:
local xpos, ypos = reaper.GetMousePosition()
reaper.TrackCtl_SetToolTip("♫", xpos+11, ypos+6, true)



Unfortunately, when using this hack in deferred MIDI scripts, the tooltip lags behind the cursor, due to the unnecessary sluggishness of the MIDI editor.
juliansader is online now   Reply With Quote
Old 07-23-2017, 02:05 PM   #3
snooks
Human being with feelings
 
Join Date: Sep 2015
Posts: 1,580
Default

Yes, big +1 to this request. We can periodically put a sort of banner popup at the top of the screen too, but having mouse cursor control would be sweet.
snooks is offline   Reply With Quote
Old 08-18-2018, 07:26 AM   #4
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,372
Default

Using some new API functions, the mouse cursor can be changed:
Code:
reaper.Mouse_SetCursor(reaper.Mouse_LoadCursor(191)) -- Loads REAPER's native "key signature" cursor
Code:
reaper.Mouse_SetCursor(reaper.Mouse_LoadCursorFromFile("...file path and name...")) -- Loads custom cursor

When the script terminates, or after each defer cycle, REAPER will change the new cursor back. To prevent this -- as long as the mouse stays within a certain window -- one can use:
Code:
reaper.WindowMessage_Intercept(window, "WM_SETCURSOR:block")

To restore the cursor if it has moved out of the window, try this:
Code:
function loop()
    if reaper.Window_FromPoint(reaper.GetMousePosition()) ~= window then
        wasOutsideWindow = true
    elseif wasOutsideWindow then
        wasOutsideWindow = false
        reaper.Mouse_SetCursor(reaper.Mouse_LoadCursor(502)) -- Set cursor again
        -- Since WM_SETCURSOR is being blocked, we must tell the window to update cursor
        reaper.WindowMessage_Send(window, "WM_SETCURSOR", 0, 0, 0, 0)
    end
    reaper.defer(loop)
end

function exit()
    reaper.WindowMessage_ReleaseWindow(window)
end

Last edited by juliansader; 08-18-2018 at 12:26 PM.
juliansader is online now   Reply With Quote
Old 08-18-2018, 09:29 AM   #5
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 1,773
Default

How cool is that! Will you add these to your MIDI CC scripts?
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is offline   Reply With Quote
Old 08-18-2018, 10:58 AM   #6
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,372
Default

Quote:
Originally Posted by _Stevie_ View Post
How cool is that! Will you add these to your MIDI CC scripts?
Yep!

juliansader is online now   Reply With Quote
Old 08-18-2018, 11:10 AM   #7
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: The vast, frozen wasteland of western Canadia.
Posts: 5,660
Default

Sorry, where did these API functions come from? I don't see them listed anywhere.
Lokasenna is online now   Reply With Quote
Old 08-18-2018, 12:29 PM   #8
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,372
Default

These are some of the API functions that I am adding the SWS, and the functions should be listed in the ReaScript API help webpage, together with all the other API functions.

My test build for Windows x64 can be download from the stash: https://stash.reaper.fm/34008/reaper_sws64.zip. (It was updated a few minutes ago.)
juliansader is online now   Reply With Quote
Old 08-18-2018, 12:35 PM   #9
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: The vast, frozen wasteland of western Canadia.
Posts: 5,660
Default

Ah, that's what I thought. It may be a good idea to avoid offering them as solutions until there's a new SWS pre available.
Lokasenna is online now   Reply With Quote
Old 08-18-2018, 12:51 PM   #10
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,372
Default

I'm actually hoping to pique others' curiosity so that they will test the new functions. The SWS release schedule is much too slow for us to wait.
juliansader is online now   Reply With Quote
Old 08-18-2018, 02:31 PM   #11
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: The vast, frozen wasteland of western Canadia.
Posts: 5,660
Default

But the thread title says "solved" and there was no mention of your build until I asked. :P
Lokasenna is online now   Reply With Quote
Old 08-21-2018, 01:30 PM   #12
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 438
Default

I like your work Juliansader and I'm currently using your new Zorder function for the Mixer visibility. Its almost perfectly solving the FX windows getting behind Mixer
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks 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 04:01 PM.


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