module Ui.KeycapsT where
import qualified Util.Rect as Rect
import qualified Ui.Color as Color
import Global
data Layout = Layout {
Layout -> (Int, Int)
lt_size :: (Int, Int)
, Layout -> Color
lt_bg_color :: Color.Color
, Layout -> Color
lt_keycap_color :: Color.Color
, Layout -> Color
lt_highlight_color :: Color.Color
, Layout -> Color
lt_label_color :: Color.Color
, Layout -> Color
lt_binding_color :: Color.Color
, Layout -> Map KeyDoc Rect
lt_labels :: Map Keycap Rect.Rect
} deriving (Int -> Layout -> ShowS
[Layout] -> ShowS
Layout -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Layout] -> ShowS
$cshowList :: [Layout] -> ShowS
show :: Layout -> String
$cshow :: Layout -> String
showsPrec :: Int -> Layout -> ShowS
$cshowsPrec :: Int -> Layout -> ShowS
Show)
type Keycap = Text
type KeyDoc = Text
type Doc = Text
type Bindings = Map Keycap Binding
data Binding = Binding {
Binding -> Maybe Color
b_color :: Maybe Color.Color
, Binding -> KeyDoc
b_text :: KeyDoc
, Binding -> KeyDoc
b_doc :: Doc
} deriving (Int -> Binding -> ShowS
[Binding] -> ShowS
Binding -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Binding] -> ShowS
$cshowList :: [Binding] -> ShowS
show :: Binding -> String
$cshow :: Binding -> String
showsPrec :: Int -> Binding -> ShowS
$cshowsPrec :: Int -> Binding -> ShowS
Show)
instance Pretty Binding where
pretty :: Binding -> KeyDoc
pretty (Binding Maybe Color
mb_color KeyDoc
text KeyDoc
doc) =
KeyDoc
text forall a. Semigroup a => a -> a -> a
<> KeyDoc
"(" forall a. Semigroup a => a -> a -> a
<> KeyDoc
doc forall a. Semigroup a => a -> a -> a
<> KeyDoc
")[" forall a. Semigroup a => a -> a -> a
<> forall a. Pretty a => a -> KeyDoc
pretty Maybe Color
mb_color forall a. Semigroup a => a -> a -> a
<> KeyDoc
"]"
no_binding :: Binding
no_binding :: Binding
no_binding = Binding
{ b_color :: Maybe Color
b_color = forall a. Maybe a
Nothing
, b_text :: KeyDoc
b_text = KeyDoc
""
, b_doc :: KeyDoc
b_doc = KeyDoc
""
}
newtype RawBindings = RawBindings [RawBinding]
deriving (Int -> RawBindings -> ShowS
[RawBindings] -> ShowS
RawBindings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RawBindings] -> ShowS
$cshowList :: [RawBindings] -> ShowS
show :: RawBindings -> String
$cshow :: RawBindings -> String
showsPrec :: Int -> RawBindings -> ShowS
$cshowsPrec :: Int -> RawBindings -> ShowS
Show)
data RawBinding = RawBinding Rect.Point Binding
deriving (Int -> RawBinding -> ShowS
[RawBinding] -> ShowS
RawBinding -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RawBinding] -> ShowS
$cshowList :: [RawBinding] -> ShowS
show :: RawBinding -> String
$cshow :: RawBinding -> String
showsPrec :: Int -> RawBinding -> ShowS
$cshowsPrec :: Int -> RawBinding -> ShowS
Show)
data CWindow