Old 01-12-2020, 10:41 AM   #1
lucas_LCS
Human being with feelings
 
Join Date: Dec 2015
Posts: 1,952
Default Layout Sub-Menus

Layout Sub-Menus
----------------------------------------------
Expand the layout menu with sub-menus.
This would make navigating the menu much faster.
Take the case of fader colors as an example:
If you have the initial layout and then 4 fader colors, you now have 5 layout entries in the menu for what is basically a single layout with 4 options for that layout.
If you have 5 layouts with 4 additional fader colors, you now have 25 entries to navigate instead of just seeing the initial 5 and then chosing the fader option for the layout you've chosen.

The current menu looks like this:



Sub-menus would make it look like this:




Navigation is clearly much faster in the second one.

::
__________________
LCS Themes
lucas_LCS is offline   Reply With Quote
Old 01-12-2020, 10:45 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 5,874
Default

+1

and even in cases where it's not faster, it looks much better and cleaned up.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-27-2020, 08:22 AM   #3
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 19,567
Default

+1.

Here's the FR I wrote, before finding this one:

At the moment, all the available layouts for an screen element (TCP, MCP, Envelope) are in a single list. I use nested Layouts in the rtconfig file to specify different coloured fader handles but this makes the Layouts menu very long and requires a lot of mouse movement / scrolling etc.

It would be much better if the Layout menu were nested too. This would make is much more compact, easier to navigate and more intuitive.

And my mock-up:



And the WALTER code for a coloured fader variant, within the general Layout, is just:
Code:
; --------------------------------------------------------------------------------
        Layout "DS M02b.      Red" "mcp_def_red"
; --------------------------------------------------------------------------------
        set mcp.extmixer.mode     [1]
        EndLayout ;
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 02-27-2020, 09:13 AM   #4
Kenny Gioia
Human being with feelings
 
Kenny Gioia's Avatar
 
Join Date: May 2010
Posts: 4,069
Default

What theme are you guys using?
Kenny Gioia is online now   Reply With Quote
Old 02-27-2020, 09:28 AM   #5
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 19,567
Default

I'm using one based on Konzentration_v11 with my own layouts and variants added for the fader colours. Hence the odd-looking layout names (needed to get them into a logical order).
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 06-23-2020, 05:20 PM   #6
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Location: India Mumbai
Posts: 790
Default

whoa this looks amazing

Last edited by zookthespook; 09-03-2020 at 11:26 AM.
zookthespook is offline   Reply With Quote
Old 06-23-2020, 06:48 PM   #7
lucas_LCS
Human being with feelings
 
Join Date: Dec 2015
Posts: 1,952
Default

@ Dark Star
I really appreciate your input on the feature request, but this thread has only 7 posts and the last 4 are not directly related.
I totally understand the desire to share, but please stay on topic.

::
__________________
LCS Themes

Last edited by lucas_LCS; 06-23-2020 at 10:52 PM. Reason: typo
lucas_LCS is offline   Reply With Quote
Old 06-24-2020, 11:08 PM   #8
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Location: India Mumbai
Posts: 790
Default

Sorry lucas it was a very colorful distraction.
But yes nested menu systems are always a +1 here too.
@darkstar plz don't distract us with the cool tools ! hehehe

peace
zook
zookthespook is offline   Reply With Quote
Old 06-25-2020, 06:00 AM   #9
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,385
Default

@DarkStar: Impressive!! Nice!

Guys, something like this? :


(bigger pic)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 06-25-2020, 11:42 AM   #10
lucas_LCS
Human being with feelings
 
Join Date: Dec 2015
Posts: 1,952
Default

@ amagalma
Yes!
how are you doing that?
Is it a script?

::
__________________
LCS Themes
lucas_LCS is offline   Reply With Quote
Old 06-25-2020, 12:39 PM   #11
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,385
Default

Code:
-- @description Smart track layout picker (categories with sub-menus)
-- @author amagalma
-- @version 1.00
-- @link https://forum.cockos.com/showthread.php?t=230114
-- @donation https://www.paypal.me/amagalma
-- @about
--   # Smart track layout picker (categories with sub-menus)
--
--   - Displays a pop-up menu with all the available tcp/mcp layouts for the track under the mouse cursor or for the selected tracks, categorized in sub-menus
--   - Smart undo naming
--   - Requires JS_ReascriptAPI


if not reaper.APIExists( "JS_Window_Find" ) then
  reaper.MB( "Please, right-click and install 'js_ReaScriptAPI: API functions for ReaScripts'. Then restart Reaper and run the script again. Thanks!", "You need to install the JS_ReaScriptAPI", 0 )
  local ok, err = reaper.ReaPack_AddSetRepository( "ReaTeam Extensions", "https://github.com/ReaTeam/Extensions/raw/master/index.xml", true, 1 )
  if ok then reaper.ReaPack_BrowsePackages( "js_ReaScriptAPI" )
  else reaper.MB( err, "Something went wrong...", 0)
  end
  return reaper.defer(function() end)
end


local track_at_mouse, context = reaper.BR_TrackAtMouseCursor()
local tracks = {}
local current_layout, _ = "[--not specified--]"
if track_at_mouse then
  tracks[1] = track_at_mouse
end
local track_cnt = reaper.CountSelectedTracks( 0 )
for i = 0, track_cnt-1 do
  local track = reaper.GetSelectedTrack( 0, i )
  if track_at_mouse ~= track then
    tracks[#tracks+1] = track
  end
end
if #tracks == 0 then return reaper.defer(function() end ) end


local function alphanumsort(o)
  -- http://notebook.kulchenko.com/algorithms/alphanumeric-natural-sorting-for-humans-in-lua
  local function padnum(d) return ("%03d%s"):format(#d, d) end
  table.sort(o, function(a,b)
    return tostring(a):gsub("%d+",padnum) < tostring(b):gsub("%d+",padnum) end)
  return o
end


local layout_parm
if context == 0 or context == 2 then
  layout_parm = "P_TCP_LAYOUT"
  context = "tcp"
else
  layout_parm = "P_MCP_LAYOUT"
  context = "mcp"
end
if #tracks == 1 then
  _, current_layout = reaper.GetSetMediaTrackInfo_String( tracks[1], layout_parm, "", false )
end


local i = 0
local t = {}
repeat
  local retval, name = reaper.ThemeLayout_GetLayout( context, i)
  i = i + 1
  if retval and name ~= "" then
    local words = {}
    local previous = ""
    local max_word = nil
    for separator, word in name:gmatch("([%s-_]*)([^%s-_]+)") do
      local scalar = previous .. (separator or "") .. word
      words[#words+1] = scalar
      if t[scalar] then
        max_word = scalar
        t[scalar][#t[scalar]+1] = name
      else
        t[scalar] = { [1] = name }
      end
      previous = scalar
    end
    for w = 1, #words do
      if max_word and words[w] ~= max_word then
        t[words[w]] = nil
      end
    end
  end
until not retval


for menu, tabl in pairs(t) do
  if #tabl > 1 then
    alphanumsort(tabl)
    for i = #tabl, 1, -1 do
      if t[tabl[i]] and tabl[i] ~= menu then
        t[tabl[i]] = nil
      end
    end
  end
end
words = nil
local n = {}
for section in pairs(t) do
  n[#n+1] = section
end
alphanumsort(n)


local r = 2
local register = {[r] = ""}
local menu = "#" .. context:upper() .. " LAYOUTS|" .. (current_layout == "" and "!" or "") .. "Global layout default|"
for i = 1, #n do
  if #t[n[i]] == 1 then
    menu = menu .. (n[i] == current_layout and "!" or "") .. n[i] .. "|"
    r = r + 1
    register[r] = n[i]
  else
    menu = menu .. ">" .. n[i] .. "|"
    for j = 1, #t[n[i]] do
      menu = menu .. (j == #t[n[i]] and "<" or "").. (t[n[i]][j] == current_layout and "!" or "") .. t[n[i]][j] .. "|"
      r = r + 1
      register[r] = t[n[i]][j]
    end
  end
end


local title = "Hidden gfx window for showing the showmenu"
gfx.init( title, 0, 0, 0, 0, 0 )
local hwnd = reaper.JS_Window_Find( title, true )
local out = 0
if hwnd then
  out = 7000
  reaper.JS_Window_Move( hwnd, -out, -out )
end
local x, y = reaper.GetMousePosition()
gfx.x, gfx.y = x-40+out, y-40+out
local selection = gfx.showmenu(menu)
gfx.quit()


if selection > 0 then
  reaper.Undo_BeginBlock()
  reaper.PreventUIRefresh(1)
  for i = 1, #tracks do
    reaper.GetSetMediaTrackInfo_String( tracks[i], layout_parm, register[selection], true)
  end
  reaper.PreventUIRefresh(-1)
  local undo = "Set " .. context:upper() .. " layout to global default"
  if register[selection] ~= "" then
    undo = "Set " .. context:upper() .. " layout to " .. register[selection]
  end
  reaper.Undo_EndBlock( undo, 1 )
end

Shortly available in ReaPack...
amagalma_Smart track layout picker (categories with sub-menus)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 06-26-2020, 01:48 AM   #12
lucas_LCS
Human being with feelings
 
Join Date: Dec 2015
Posts: 1,952
Default

Quote:
Originally Posted by amagalma View Post
Shortly available in ReaPack...
amagalma_Smart track layout picker (categories with sub-menus)
It's really very nice, but I think sub-menus need to be native to Reaper out of the box.

::
__________________
LCS Themes
lucas_LCS is offline   Reply With Quote
Old 06-26-2020, 04:53 AM   #13
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,385
Default

Quote:
Originally Posted by lucas_LCS View Post
It's really very nice, but I think sub-menus need to be native to Reaper out of the box.

::

No problem! Works for me Meanwhile, you can wait for the native implementation..
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 06-26-2020, 11:50 AM   #14
lucas_LCS
Human being with feelings
 
Join Date: Dec 2015
Posts: 1,952
Default

Quote:
Originally Posted by amagalma View Post
No problem! Works for me Meanwhile, you can wait for the native implementation..
LOL.
I can easily use a script.

The issue is newbies or people who don't want or know how to install a script.
Your script is excellent and so is Dark Star's, but this function seems like it should already be there when you open Reaper for the first time.

Still, I wouldn't mind checking this out.
What needs to be done to layout names in the RTConfig for them to be seen as sub-layouts?

::
__________________
LCS Themes

Last edited by lucas_LCS; 06-26-2020 at 11:58 AM.
lucas_LCS is offline   Reply With Quote
Old 06-26-2020, 04:07 PM   #15
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,385
Default

Quote:
Originally Posted by lucas_LCS View Post
What needs to be done to layout names in the RTConfig for them to be seen as sub-layouts?
::
Nothing. The script automatically does it for you on-the-fly for any theme. Just assign it to a shortcut and press it when the mouse is over a TCP or MCP or if there are tracks selected.
__________________
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; 06-27-2020 at 01:52 AM.
amagalma is offline   Reply With Quote
Old 01-24-2023, 09:01 PM   #16
PMan
Human being with feelings
 
Join Date: Aug 2019
Posts: 480
Default

I can't get this to work...

I'm running Reaper 6.73 on Ubuntu 22.04.1. I have it assigned to a shortcut, but when I press the shortcut (mouse over a track or track selected, or both), nothing happens. If I press a 2nd time, I get the popup about an instance running, that asks do I want to terminate the 1st instance or start a 2nd instance.

I installed via ReaPack...
PMan is offline   Reply With Quote
Old 01-25-2023, 08:17 AM   #17
EduSerra
Human being with feelings
 
EduSerra's Avatar
 
Join Date: Apr 2021
Location: Colombia
Posts: 106
Default

This is really needed! +1
EduSerra is online now   Reply With Quote
Old 01-25-2023, 09:04 AM   #18
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,385
Default

Quote:
Originally Posted by PMan View Post
I can't get this to work...

I'm running Reaper 6.73 on Ubuntu 22.04.1. I have it assigned to a shortcut, but when I press the shortcut (mouse over a track or track selected, or both), nothing happens. If I press a 2nd time, I get the popup about an instance running, that asks do I want to terminate the 1st instance or start a 2nd instance.

I installed via ReaPack...
Unfortunately, I can't test on Linux.. Try this:

Go to line 132 of the script and comment it out like this:
Code:
--reaper.JS_Window_Show( hwnd, "HIDE" )
Save and run and see if that helped..

If not then comment our line 134 too and save and run:
Code:
--gfx.x, gfx.y = gfx.mouse_x-40, gfx.mouse_y-40
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 01-25-2023, 01:33 PM   #19
PMan
Human being with feelings
 
Join Date: Aug 2019
Posts: 480
Default

Quote:
Originally Posted by amagalma View Post
Try this:

Go to line 132 of the script and comment it out like this:
Code:
--reaper.JS_Window_Show( hwnd, "HIDE" )
Yes! it worked! This is great!

Many thanks, and a donation heading your way!
PMan 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 11:55 AM.


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