From ef748eba18541b5d8b28fade4bb00fa3595e8f6d Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Fri, 12 Feb 2021 15:17:55 +0000 Subject: [PATCH 1/6] Remove Legacy ItemGrid pages and simplify main event loop --- components/ItemGrid.brs | 96 -------------------------- components/ItemGrid.xml | 10 --- components/collections/Collections.brs | 14 ---- components/collections/Collections.xml | 14 ---- components/tvshows/TVShows.brs | 14 ---- components/tvshows/TVShows.xml | 14 ---- source/Main.brs | 43 +----------- source/ShowScenes.brs | 94 +------------------------ 8 files changed, 4 insertions(+), 295 deletions(-) delete mode 100644 components/ItemGrid.brs delete mode 100644 components/ItemGrid.xml delete mode 100644 components/collections/Collections.brs delete mode 100644 components/collections/Collections.xml delete mode 100644 components/tvshows/TVShows.brs delete mode 100644 components/tvshows/TVShows.xml diff --git a/components/ItemGrid.brs b/components/ItemGrid.brs deleted file mode 100644 index 69fc316a..00000000 --- a/components/ItemGrid.brs +++ /dev/null @@ -1,96 +0,0 @@ -sub init() - m.top.itemComponentName = "ListPoster" - m.top.content = setData() - - m.top.rowFocusAnimationStyle = "floatingFocus" - - m.top.showRowLabel = [false] - - m.top.setFocus(true) -end sub - -sub updateSize() - m.top.numRows = 1 - if m.top.itemsPerRow = invalid or m.top.itemsPerRow = 0 then - m.top.itemsPerRow = 6 - end if - - dimensions = m.top.getScene().currentDesignResolution - - topBorder = 75 - border = 96 - topSpace = topBorder + 105 - m.top.translation = [96, topSpace] - - textHeight = 100 - itemWidth = (dimensions["width"] - border*2) / m.top.itemsPerRow -20 - itemHeight = itemWidth * 1.5 + textHeight - - if itemHeight*m.top.rowsPerPage > (dimensions["height"] - topBorder - 115) then - ratio = (itemHeight*m.top.rowsPerPage) / (981 - topSpace - 15) - itemHeight = itemHeight / ratio - itemWidth = itemWidth / ratio - end if - m.top.visible = true - - ' Size of the individual rows - m.top.itemSize = [dimensions["width"] - border*2, itemHeight] - ' Spacing between Rows - m.top.itemSpacing = [ 0, 10] - - ' Size of items in the row - m.top.rowItemSize = [ itemWidth, itemHeight ] - ' Spacing between items in the row - itemSpace = (dimensions["width"] - border*2 - itemWidth*m.top.itemsPerRow) / (m.top.itemsPerRow-1) - m.top.rowItemSpacing = [ itemSpace-1, 0 ] -end sub - -function setupRows() - updateSize() - - objects = m.top.objects - itemsPerRow = m.top.itemsPerRow - - n = objects.items.count() - - ' This tests to make sure we are at an integer number of rows - if int(n/itemsPerRow) = n/itemsPerRow then - m.top.numRows = n/itemsPerRow - ' Otherwise we need an extra (not full) row for the leftovers - else - m.top.numRows = n/itemsPerRow + 1 - end if - - m.top.content = setData() - -end function - -function setData() - data = CreateObject("roSGNode", "ContentNode") - if m.top.objects = invalid then - ' Return an empty node just to return something; we'll update once we have data - return data - end if - - objects = m.top.objects - itemsPerRow = m.top.itemsPerRow - - for rowNum = 1 to m.top.numRows - row = data.CreateChild("ContentNode") - for i = 1 to itemsPerRow - index = (rowNum - 1) * itemsPerRow + i - if index > objects.items.count() then - exit for - end if - row.appendChild(objects.items[index-1]) - end for - end for - - return data -end function - -function onKeyEvent(key as string, press as boolean) as boolean - if not press then return false - - return false -end function diff --git a/components/ItemGrid.xml b/components/ItemGrid.xml deleted file mode 100644 index 8a051b8e..00000000 --- a/components/ItemGrid.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - -