{-# OPTIONS_GHC -optc-D_LARGEFILE_SOURCE #-}
{-# OPTIONS_GHC -optc-D_LARGEFILE64_SOURCE #-}
{-# OPTIONS_GHC -optc-D_THREAD_SAFE #-}
{-# OPTIONS_GHC -optc-D_REENTRANT #-}
{-# OPTIONS_GHC -optc-DBUILD_DIR="build/debug" #-}
{-# OPTIONS_GHC -optc-DGHC_VERSION=90205 #-}
{-# OPTIONS_GHC -optc-D__APPLE__ #-}
{-# LINE 1 "App/Config.hsc" #-}
module App.Config where
import qualified Data.Array.IArray as IArray
import qualified Data.Bits as Bits
import qualified Data.Map.Strict as Map
import qualified Data.Time as Time
import qualified System.Info
import qualified App.Path as Path
import App.Path ((</>))
import qualified Util.Array as Array
import qualified Ui.Color as Color
import qualified Ui.Style as Style
import qualified Ui.Types as Types
import qualified Ui.Zoom as Zoom
import Global
type SelNum = Int
data Platform = Mac | Linux deriving (Show, Eq)
platform :: Platform
platform = case System.Info.os of
"darwin" -> Mac
_ -> Linux
data_dir :: Path.Relative
data_dir = "data"
save_dir :: Path.Relative
save_dir = data_dir </> "save"
ky_paths :: [Path.Relative]
ky_paths = [local_dir </> "ky"]
instrument_dir :: Path.Relative
instrument_dir = data_dir </> "inst_db"
im_dir :: Path.Relative
im_dir = data_dir </> "im"
sc_dir :: Path.Relative
sc_dir = data_dir </> "sc"
instrument_cache_dir :: Path.Relative
instrument_cache_dir = instrument_dir </> "db"
local_dir :: Path.Relative
local_dir = "Local"
log_dir :: Path.Relative
log_dir = "log"
type SortKey = Int
status_chord :: (SortKey, Text)
status_chord = (7, "chord")
status_control :: (SortKey, Text)
status_control = (6, "c")
status_selection :: (SortKey, Text)
status_selection = (8, "s")
status_track_id :: (SortKey, Text)
status_track_id = (12, "tid")
status_zoom :: (SortKey, Text)
status_zoom = (10, "z")
status_octave :: (SortKey, Text)
status_octave = (0, "8")
status_step :: (SortKey, Text)
status_step = (1, "t")
status_record :: (SortKey, Text)
status_record = (4, "r")
status_note :: (SortKey, Text)
status_note = (5, "n")
status_note_text :: (SortKey, Text)
status_note_text = (5, "note")
status_integrate_source :: (SortKey, Text)
status_integrate_source = (8, "src")
repl_socket_name :: FilePath
repl_socket_name = "seq-repl"
mouse_select :: Types.MouseButton
mouse_select = 1
insert_selnum :: SelNum
temporary_insert_selnum :: SelNum
error_selnum :: SelNum
step_play_selnum :: SelNum
play_position_selnum :: SelNum
highlight_selnum :: SelNum
im_progress_selnum :: SelNum
max_selnums :: SelNum
max_selnums = 8
[ (insert_selnum, _)
, _
, (temporary_insert_selnum, _)
, (error_selnum, _)
, (play_position_selnum, play_selection_color)
, (step_play_selnum, _)
, (highlight_selnum, _)
, (im_progress_selnum, _)
] = zip [0..] selection_colors
selection_colors :: [Color.Color]
selection_colors = map to_sel $ take max_selnums $
[ Color.blue, Color.green, Color.yellow, Color.red, Color.purple
, Color.turquoise
] ++ repeat Color.black
where to_sel = Color.alpha 0.3 . Color.brightness 1.25
lookup_selection_color :: SelNum -> Color.Color
lookup_selection_color selnum
| Array.in_bounds selnum a = a IArray.! selnum
| otherwise = Color.black
where a = Array.from_list selection_colors
highlight_colors :: Map Color.Highlight Color.Color
highlight_colors = Map.fromList
[ (Color.Notice, Color.alpha 0.15 Color.green)
, (Color.Warning, Color.alpha 0.1 Color.red)
, (Color.Error, Color.alpha 0.25 Color.red)
]
box_color, val_edit_color, method_edit_color :: Color.Color
box_color = Color.rgb 0.7 0.7 0.7
val_edit_color = Color.rgb 1 0.5 0.5
method_edit_color = Color.rgb 0.6 0 0
advance_color, no_advance_color :: Color.Color
advance_color = play_color
no_advance_color = val_edit_color
play_color :: Color.Color
play_color = Color.rgb 0 0.6 0
abbreviation_color :: Color.Color
abbreviation_color = Color.rgba_word (65280)
{-# LINE 240 "App/Config.hsc" #-}
busy_color :: Color.Color
busy_color = Color.rgb 0 1 1
mute_color, solo_color :: Color.Color
mute_color = Color.gray6
solo_color = Color.rgb 1 0.75 0.75
im_pending_color, im_working_color :: Color.Color
im_pending_color = Color.rgba 0 0 0 0.15
im_working_color = Color.alpha 0.15 busy_color
track_bg, ruler_bg :: Color.Color
track_bg = Color.white
ruler_bg = Color.rgb 1 0.85 0.5
status_default :: Color.Color
status_default = Color.white
status_root :: Color.Color
status_root = Color.rgb 1 1 0.8
status_integrate_destination :: Color.Color
status_integrate_destination = Color.rgb 1 0.85 0.85
status_score_integrate_destination :: Color.Color
status_score_integrate_destination = Color.rgb 0.85 1 0.85
skeleton :: Color.Color
skeleton = Color.black
integrate_skeleton :: Color.Color
integrate_skeleton = Color.red
score_integrate_skeleton :: Color.Color
score_integrate_skeleton = Color.green
default_derive_wait :: Time.NominalDiffTime
default_derive_wait = 1
default_keep_history :: Int
default_keep_history = 20
default_scale_id :: Text
default_scale_id = "twelve"
read_device_pb_range :: (Int, Int)
read_device_pb_range = (-2, 2)
view_size :: (Int, Int)
view_size = (300, 300)
zoom :: Zoom.Zoom
zoom = Zoom.Zoom { offset = 0, factor = 46 }
ruler_width :: Types.Width
ruler_width = 18
track_width :: Types.Width
track_width = 40
collapsed_width :: Types.Width
collapsed_width = 3
track_signal_color :: Color.Color
track_signal_color = Color.rgba 0.65 0.65 0.8 0.5
clip_namespace :: Text
clip_namespace = "clip"
clip_block_name :: Text
clip_block_name = "clip"
bconfig_box :: (Color.Color, Char)
bconfig_box = (box_color, ' ')
view_top_padding :: Int
view_top_padding =
16
{-# LINE 360 "App/Config.hsc" #-}
+ 17
{-# LINE 361 "App/Config.hsc" #-}
+ 2
block_title_height :: Int
block_title_height = 17
{-# LINE 365 "App/Config.hsc" #-}
track_title_height :: Int
track_title_height = 17
{-# LINE 368 "App/Config.hsc" #-}
view_bottom_padding :: Int
view_bottom_padding =
6
{-# LINE 372 "App/Config.hsc" #-}
+ 16
{-# LINE 373 "App/Config.hsc" #-}
+ 2
view_left_padding :: Int
view_left_padding = 6
{-# LINE 377 "App/Config.hsc" #-}
window_decoration_h :: Int
window_decoration_h = case platform of
Linux -> 0
Mac -> 22
bravura :: String
bravura = "Bravura"
event_text_height :: Int
event_text_height = 15
event_comment :: Text
event_comment = "--|"
styles :: [Style.Style]
styles =
[ style { Style.style_face = face }
| style <- plain_styles, face <- style_faces
]
style_faces :: [[Style.FontFace]]
style_faces = [[], [Style.Bold], [Style.Italic], [Style.Bold, Style.Italic]]
set_face :: Bool -> Style.FontFace -> Style.StyleId -> Style.StyleId
set_face set face (Style.StyleId style) =
Style.StyleId $ n * faces + case face of
Style.Bold -> set_bit c 0
Style.Italic -> set_bit c 1
where
set_bit = if set then Bits.setBit else Bits.clearBit
(n, c) = style `divMod` faces
faces = fromIntegral (length style_faces)
event_style :: Style -> Style.StyleId -> Style.StyleId
event_style style (Style.StyleId code) =
Style.StyleId $ fromIntegral (fromEnum style) * faces + code `mod` faces
where faces = fromIntegral (length style_faces)
data Style =
Note | NoteBlockCall | Control | Pitch | NoteParent | Error | Commented
deriving (Enum, Show)
default_style :: Style.StyleId
default_style = Style.StyleId 0
plain_styles :: [Style.Style]
plain_styles =
[ plain note_color
, plain block_call_color
, plain control_color
, plain pitch_color
, plain note_parent_color
, plain parse_error_color
, commented
]
where
commented = (plain Color.gray8) { Style.style_text_color = Color.gray4 }
plain event_color = Style.Style
{ style_font = Style.Helvetica
, style_face = []
, style_size = 12
, style_text_color = Color.black
, style_event_color = event_color
}
note_color :: Color.Color
note_color = Color.rgb 0.9 0.9 0.7
block_call_color :: Color.Color
block_call_color = note_parent_color
control_color :: Color.Color
control_color = Color.rgb 0.7 0.8 0.7
pitch_color :: Color.Color
pitch_color = Color.rgb 0.7 0.8 0.9
note_parent_color :: Color.Color
note_parent_color = Color.rgb 1.0 1.0 0.65
parse_error_color :: Color.Color
parse_error_color = Color.rgb 1.0 0.8 0.8
integrated_style :: Style.StyleId -> Style.StyleId
integrated_style = set_face True Style.Italic
unmodified_style :: Style.StyleId -> Style.StyleId
unmodified_style = set_face True Style.Bold
modified_style :: Style.StyleId -> Style.StyleId
modified_style = set_face False Style.Bold