Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Cmd.Internal

Contents

Description

Internal Cmds, that keep bits of Cmd.State up to date that everyone else relies on.

Synopsis

record keys

cmd_record_keys :: Cmd.M m => Msg.Msg -> m Cmd.Status Source #

Record keydowns into the State modifier map.

msg_to_key_mods :: Msg.Msg -> Maybe.Maybe [Key.Modifier] Source #

Get the set of Key.Modifiers from the msg.

msg_to_mod :: Msg.Msg -> Maybe.Maybe (Bool, Maybe.Maybe Cmd.Modifier) Source #

Convert a Msg to (is_key_down, Modifier).

focus

record ui updates

cmd_record_ui_updates :: Cmd.M m => Msg.Msg -> m Cmd.Status Source #

Catch UiMsg.UiUpdates from the UI, and modify the state accordingly to reflect the UI state.

Unlike all the other Cmds, the state changes this makes are not synced. UiUpdates report changes that have already occurred directly on the UI, so syncing them would be redundant.

update_ui_state :: Cmd.M m => Msg.Msg -> m Cmd.Status Source #

This is the other half of cmd_record_ui_updates, whose output is synced like normal Cmds. When its a block update I have to update the other views.

set style

event_style :: Bool -> Event.EventStyle Source #

Set the style of an event based on its contents. This is hardcoded for now but it's easy to put in StaticConfig if needed.

track_bg :: Track.Track -> Color.Color Source #

Set the track background color.

sync

sync_status :: Ui.State -> Cmd.State -> Cmd.CmdId Cmd.Status Source #

This is called after every non-failing cmd.

update_saved :: [Update.CmdUpdate] -> Ui.State -> Ui.State -> Cmd.State -> Cmd.State Source #

Flip Cmd.state_saved if the score has changed. Cmd.Save will turn it back on after a save.

can_checkpoint Source #

Arguments

:: Cmd.State 
-> Maybe.Maybe (GitTypes.Repo, GitTypes.Commit)

I need both a repo and a previous commit to checkpoint.

Return Just if there will be a git checkpoint. update_saved has to predict this because by the time save_history runs, it's too late to make Ui.State changes.

This is not defined in Cmd.Undo to avoid a circular import.

hooks

sync

sync_edit_box :: Cmd.M m => SaveStatus -> Cmd.EditState -> m () Source #

The two upper boxes reflect the edit state. The lower box is red for Cmd.ValEdit or dark red for Cmd.MethodEdit. The upper box is green for Cmd.state_advance mode, and red otherwise.

The lower box has a K if Cmd.state_kbd_entry mode is enabled, and the upper box has an o if Cmd.state_chord mode is enabled. The upper box also has a / if the score state hasn't been saved to disk, or x if it can't save to disk because there is no save file.

selection

pretty_rational :: ScoreTime.ScoreTime -> Text Source #

If a ScoreTime looks like a low fraction, display it thus, rather than as a decimal. This is useful because e.g. meters in three will have lots of repeating decimals. I also use fractions for power of two denominators which are just fine in decimal, but the fraction still takes up less space.

selection control value

track_control :: Cmd.M m => Id.BlockId -> Id.TrackId -> ScoreTime.ScoreTime -> m (Maybe.Maybe Text) Source #

This uses Msg.perf_track_signals rather than Msg.perf_track_dynamic because track dynamics have the callers controls on a control track