View Single Post
Old 11-16-2019, 11:36 AM   #1
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default Q: Docker indexes (test script included)

I found a nice way to quickly dock/undock script windows, but I guess that this wouldn't work on every computer or different reaper screen layouts etc...

gfx.dock function:
Code:
Lua: gfx.dock(v[,wx,wy,ww,wh])

Call with v=-1 to query docked state, otherwise v>=0 to set docked state. State is &1 if docked, second byte is docker index (or last docker index if undocked). If wx-wh specified, additional values will be returned with the undocked window position/size
This works on my computer/reaper settings, but probably not for someone else - Dock on lmb release:
Code:
function on_lmb_up()
  mouse.lmb_up_time = os.clock()
  --_, GUI.left_scr, GUI.top_scr, GUI.w_scr, GUI.h_scr = gfx.dock(-1,0,0,0,0)
  local dock, x, y, w, h =  gfx.dock(-1,0,0,0,0)
  if GUI.drag and gfx.dock(-1)&1 == 0 then
    local left, top, right, bottom = reaper.my_getViewport(0, 0, 0, 0, 0, 0, 0, 0, 0)
    if y <= 0 then
      gfx.dock(769) -- top
    elseif x <= 0 then
      gfx.dock(269) -- left
    elseif
      x + w >= right then
      gfx.dock(513) -- right
    end
  end
  GUI.drag = false
end

So, does anyone know how different reaper screen settings/layouts affect the docker indexes?


Last edited by spk77; 11-17-2019 at 01:47 PM.
spk77 is offline   Reply With Quote