Rethink selection lists as intmaps
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user