-- Copyright 2013 Evan Laforge
-- This program is distributed under the terms of the GNU General Public
-- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt

-- | Symbols used in calls.
module Derive.Call.Symbols (symbols) where
import qualified Ui.Symbol as Symbol
import qualified App.Config as Config
import Global


symbols :: [Symbol.Symbol]
symbols :: [Symbol]
symbols = [Symbol]
misc forall a. [a] -> [a] -> [a]
++ [Symbol]
bravura

misc :: [Symbol.Symbol]
misc :: [Symbol]
misc =
    [ Text -> Bool -> [Glyph] -> Symbol
Symbol.Symbol Text
"0x" Bool
True
        [Int -> (Double, Double) -> Glyph -> Glyph
Symbol.glyph_at (-Int
2) (Double
0, -Double
0.4) (Text -> Glyph
Symbol.glyph Text
"x")]
    , Text -> Text -> Symbol
simple Text
"up" Text
"↑"
    , Text -> Text -> Symbol
simple Text
"^" Text
"↑"
    , Text -> Text -> Symbol
simple Text
"right" Text
"→"
    , Text -> Text -> Symbol
simple Text
"left" Text
"←"
    , Text -> Text -> Symbol
simple Text
"down" Text
"↓"
    , Text -> Text -> Symbol
simple Text
"_" Text
"↓"
    ]

simple :: Text -> Text -> Symbol.Symbol
simple :: Text -> Text -> Symbol
simple Text
name Text
text = Text -> [Glyph] -> Symbol
Symbol.symbol Text
name [Text -> Glyph
Symbol.glyph Text
text]

-- | See <http://www.smufl.org/version/latest/>
--
-- TODO if I do more of these, I could load glyphnames.json to address these by
-- name.  I probably don't want to load every single glyph as-is though.
bravura :: [Symbol.Symbol]
bravura :: [Symbol]
bravura =
    [ Text -> Text -> Symbol
symbol Text
"tr" Text
"\xe566"
    , Text -> Text -> Symbol
symbol Text
"mordent" Text
"\xe56c" -- ornamentMordent
    , Text -> Text -> Symbol
symbol Text
"rmordent" Text
"\xe56d" -- ornamentMordentInverted
    -- There is also "\xe634", but it's too tall and skinny.
    , Text -> [Glyph] -> Symbol
Symbol.symbol Text
"arp-up"
        [ Int -> (Double, Double) -> Text -> Glyph
arp_glyph Int
90 (Double
0, -Double
0.25) Text
"\xeaad" -- wiggleArpeggiatoUpArrow
        , Int -> (Double, Double) -> Text -> Glyph
arp_glyph Int
90 (Double
0, Double
0) Text
"\xeaa9" -- wiggleArpeggiatoUp
        ]
    , Text -> [Glyph] -> Symbol
Symbol.symbol Text
"arp-down" -- Or "\xe635".
        [ Int -> (Double, Double) -> Text -> Glyph
arp_glyph (-Int
90) (Double
0, Double
0.25) Text
"\xeaae" -- wiggleArpeggiatoDownArrow
        , Int -> (Double, Double) -> Text -> Glyph
arp_glyph (-Int
90) (Double
0, Double
0) Text
"\xeaaa" -- wiggleArpeggiatoDown
        ]
    , Text -> Text -> Symbol
symbol Text
"ped" Text
"\xe650" -- keyboardPedalPed
    , Text -> Text -> Symbol
symbol Text
"ped-up" Text
"\xe655" -- keyboardPedalUp

    -- Standard unicode also has them, though as combining characters:
    -- MUSICAL SYMBOL COMBINING DOWN BOW: U+1D1AA
    -- MUSICAL SYMBOL COMBINING UP BOW: U+1D1AB
    , Text -> Text -> Symbol
symbol Text
"upbow" Text
"\xe612" -- stringsUpBow
    , Text -> Text -> Symbol
symbol Text
"downbow" Text
"\xe610" -- stringsDownBow
    ]
    where
    arp_glyph :: Int -> (Double, Double) -> Text -> Glyph
arp_glyph Int
rotate (Double, Double)
align Text
str = (Text -> Glyph
glyph Text
str)
        { glyph_align :: (Double, Double)
Symbol.glyph_align = (Double, Double)
align
        , glyph_rotate :: Int
Symbol.glyph_rotate = Int
rotate
        }
    glyph :: Text -> Glyph
glyph Text
str = Text -> Maybe Font -> Int -> (Double, Double) -> Int -> Glyph
Symbol.Glyph Text
str (forall a. a -> Maybe a
Just Font
Config.bravura) Int
8 (Double
0, Double
0) Int
0
    symbol :: Text -> Text -> Symbol
symbol Text
name Text
str = Symbol.Symbol
        { name :: Text
name = Text
name, absolute_y :: Bool
absolute_y = Bool
False, glyphs :: [Glyph]
glyphs = [Text -> Glyph
glyph Text
str] }