Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 08-07-2018, 11:42 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default Move Mixer out of the way: example of Win32/SWELL in ReaScript

Some users have noted that the Mixer gets in the way of FX and other windows:

Quote:
Originally Posted by D Rocks View Post
... For now I only noticed the Mixer Window getting in front of floating FX that I dont automatically think of putting "always on top". I could develop the habit to click always on top each time a new FX window is openned but I'll find a solution that does it automatically somehow until it becomes built-in.

What do you think could be done with the script you mentionned? It would be Lua?
This problem can serve as an example of using Win32/SWELL functions in ReaScripts. Here are two alternatives:
* A script that moves the mixer to the back when you press a shortcut.
* A script that runs in the background a automatically moves the mixer to the back when you click on another window.

(A test build of SWS for Windows x64 is required.)

Code:
-- Move Mixer window (docker or undocked) to the back when shortcut is pressed
m = reaper.Window_Find("Mixer (docked)", true)
if m then reaper.Window_SetZOrder(m, "INSERT_AFTER", reaper.GetMainHwnd(), 0x0010) end
m = reaper.Window_Find("Mixer", true)
if m then reaper.Window_SetZOrder(m, "INSERT_AFTER", reaper.GetMainHwnd(), 0x0010) end
reaper.defer(function() end)
Code:
-- This script runs the background, automatically moving Mixer window to the back when it loses focus.
function loop()
    w = reaper.Window_GetForeground()
    if w and w ~= prevW then -- Has foreground window been changed?
        prevW = w
        -- Check if new foreground window is Mixer. If not, try to find Mixer and and if it exists, move it back
        t = reaper.Window_GetTitle(w, "") 
        if not t:match("Mixer") then
            m = reaper.Window_Find("Mixer (docked)", true)
            if m then reaper.Window_SetZOrder(m, "INSERT_AFTER", reaper.GetMainHwnd(), 0x0010) end
            m = reaper.Window_Find("Mixer", true)
            if m then reaper.Window_SetZOrder(m, "INSERT_AFTER", reaper.GetMainHwnd(), 0x0010) end
    end end
    reaper.defer(loop)
end

reaper.atexit()

loop()

Last edited by juliansader; 10-13-2018 at 01:45 PM.
juliansader is offline   Reply With Quote
 

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 05:58 AM.


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