Thread: ReaLauncher
View Single Post
Old 07-07-2018, 06:59 AM   #6
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Hawt. Couple of things:

- Have you considered making this available via ReaPack? It makes updating the script way easier, since end-users can just click a button to do it, and it sidesteps issues a few people have found with some browsers and trying to download .lua files.

- Probably worth mentioning the SWS Startup Actions in your OP, and how to set this up with it. Users would also want to open Preferences | General and change "Open projects on startup" to New Project, if they were previously using the Reaper launcher.

- UpdateListFilters is re-sorting the list on EVERY loop and using an insane amount of CPU - 12% here on my laptop. In general, it's wise to check whether you need to re-sort so you can skip the function unless it's necessary. I just add a global variable here, but you may prefer storing it somewhere else:
Code:
local function UpdateListFilters()

  local filter = GUI.Val("tabs")
  if filter == last_filter then return end

  -- Recent Projects tab
  if filter then
    if RecentProjectFilterActive then
      GUI.elms.lst_recentProjects.list = filteredRecentProjects
    else
      -- Listbox sort mode: Default (most recent project at the top) / Ascending / Descending
      local sortMode = GUI.Val("menu_sort")
      if sortMode == 1 then
        SortDef()
      elseif sortMode == 2 then
        SortAsc()     
      else
        SortDesc()
      end
    end
  end
  -- Project Templates tab
  if filter then
    if ProjectTemplateFilterActive then
      GUI.elms.lst_projectTemplates.list = filteredProjectTemplates
    else
      GUI.elms.lst_projectTemplates.list = projectTemplates
    end
  end
  -- Track Templatse tab
  if filter then
    if TrackTemplateFilterActive then
      GUI.elms.lst_trackTemplates.list = filteredTrackTemplates
    else
      GUI.elms.lst_trackTemplates.list = trackTemplates
    end
  end

  last_filter = filter
end

- What's the purpose of the OSX + setfont code? My GUI automatically does that anyway.

- It doesn't make a difference, but your force-the-same-window-size code could actually go in GUI.onresize. It gets run at the beginning of each loop if the window has been resized; GUI.resized is set at the exact same time and works just as well, of course. Individual elements can also have an onresize method that will be called as part of their update loop as needed.

Code:
GUI.onresize = function()
-- check and force the resize
end
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate

Last edited by Lokasenna; 07-07-2018 at 07:19 AM.
Lokasenna is offline   Reply With Quote