Work on mouse selection in options menu

This commit is contained in:
2023-05-10 10:02:37 +01:00
parent ab714d63db
commit cc42a5e124
10 changed files with 130 additions and 88 deletions
+32 -25
View File
@@ -1,19 +1,22 @@
{-# LANGUAGE StrictData #-}
--{-# LANGUAGE DeriveGeneric #-}
--{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.SelectionList where
import Picture.Data
import Color
import Control.Lens
import Dodge.Data.CardinalPoint
import Data.IntMap.Strict (IntMap)
import Dodge.Data.CardinalPoint
import Dodge.Data.ScreenPos
import Picture.Data
--import Data.Aeson
--import Data.Aeson.TH
data ListDisplayParams = ListDisplayParams
{ _ldpPosX :: Float
, _ldpPosY :: Float
{ _ldpPos :: ScreenPos
, _ldpScale :: Float
, _ldpVerticalGap :: Float
, _ldpCursorSides :: [CardinalPoint]
@@ -23,12 +26,12 @@ data ListDisplayParams = ListDisplayParams
data SelectionList a = SelectionList
{ _slItems :: [SelectionItem a]
, _slSelPos :: Maybe Int
, _slRegex :: String
, _slRegex :: String
, _slRegexInput :: Bool
, _slRegexList :: [(SelectionItem a, Maybe Int)]
}
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data SelectionSections a = SelectionSections
{ _sssSections :: IntMap (SelectionSection a)
@@ -39,7 +42,7 @@ data SelectionSections a = SelectionSections
-- a pair of ints (i,i+1) such that the lower is the regex section, the higher
-- is the items section.
data SSSExtra = SSSExtra
{ _sssSelPos :: Maybe (Int,Int)
{ _sssSelPos :: Maybe (Int, Int)
, _sssFilters :: IntMap (Maybe String)
}
@@ -58,29 +61,32 @@ data SelectionSection a = SelectionSection
, _ssIndent :: Int
, _ssDescriptor :: String
}
data SelectionWidth = FixedSelectionWidth Int
data SelectionWidth
= FixedSelectionWidth Int
| VariableSelectionWidth (Int -> Int)
| UseMaxSelectionItemWidth
data CursorType = NoCursor
data CursorType
= NoCursor
| BorderCursor [CardinalPoint]
data SelectionItem a = SelectionItem
{ _siPictures :: [String]
, _siHeight :: Int
, _siIsSelectable :: Bool
, _siColor :: Color
, _siOffX :: Int
, _siPayload :: a
}
data SelectionItem a
= SelectionItem
{ _siPictures :: [String]
, _siHeight :: Int
, _siIsSelectable :: Bool
, _siColor :: Color
, _siOffX :: Int
, _siPayload :: a
}
| SelectionInfo
{ _siPictures :: [String]
, _siHeight :: Int
, _siIsSelectable :: Bool
, _siColor :: Color
, _siOffX :: Int
}
{ _siPictures :: [String]
, _siHeight :: Int
, _siIsSelectable :: Bool
, _siColor :: Color
, _siOffX :: Int
}
makeLenses ''ListDisplayParams
makeLenses ''SelectionList
@@ -89,5 +95,6 @@ makeLenses ''SelectionSection
makeLenses ''SelectionSections
makeLenses ''SSSExtra
makeLenses ''SectionCursor
--deriveJSON defaultOptions ''SelectionItem
--deriveJSON defaultOptions ''SelectionList