Rethink selection lists as intmaps

This commit is contained in:
2023-01-15 23:17:47 +00:00
parent 17734738f6
commit 048135c370
17 changed files with 245 additions and 93 deletions
+14 -1
View File
@@ -6,6 +6,7 @@ module Dodge.Data.SelectionList where
import Color
import Control.Lens
import Dodge.Data.CardinalPoint
import Data.IntMap.Strict (IntMap)
--import Data.Aeson
--import Data.Aeson.TH
@@ -25,6 +26,17 @@ data SelectionList a = SelectionList
, _slLength :: Int
, _slRegex :: String
, _slRegexInput :: Bool
, _slRegexList :: [(SelectionItem a, Maybe Int)]
}
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data SelectionIntMap a = SelectionIntMap
{ _smItems :: [SelectionItem a]
, _smSelPos :: Maybe Int
, _smLength :: Int
, _smRegex :: String
, _smRegexInput :: Bool
, _smShownItems :: IntMap (SelectionItem a)
}
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
@@ -44,7 +56,7 @@ data SelectionItem a = SelectionItem
, _siOffX :: Int
, _siPayload :: a
}
| SelectionFilter
| SelectionInfo
{ _siPictures :: [String]
, _siHeight :: Int
, _siIsSelectable :: Bool
@@ -57,5 +69,6 @@ data SelectionItem a = SelectionItem
makeLenses ''ListDisplayParams
makeLenses ''SelectionList
makeLenses ''SelectionItem
makeLenses ''SelectionIntMap
--deriveJSON defaultOptions ''SelectionItem
--deriveJSON defaultOptions ''SelectionList