Karya, built on Sun Nov 26 01:04:37 PST 2017 (patch 0a920b2bde70c0cbac8ee09d158064798b61bbe5)

Safe HaskellNone




Updates are diffs against Ui.State and are used in a number of contexts. They are produced by Ui.Diff. The different uses all require slightly different data, and I capture the major differences in separate types.



type DisplayUpdate = Update Block.DisplayTrack () Source #

DisplayUpdates are sent to the UI to update the windows. Since the UI only has Views, and has a lower level version of tracks, this includes only updates that directly affect display.

type UiUpdate = Update Block.Track State Source #

UiUpdates reflect all changes to the underlying UI state. They're used for incremental save, and by the deriver to determine ScoreDamage.

data CmdUpdate Source #

For efficiency, TrackEvents updates are collected directly in Ui.State as the changes are made. This is because I'm afraid a complete diff against all the events in a score would be too expensive to run after every cmd. To express that there are only a few kinds of these updates, and since they are the only ones saved with their cmds, they are given their own type, CmdUpdate. These are also saved with the undo history.


CmdTrackEvents Id.TrackId ScoreTime ScoreTime 
CmdTrackAllEvents Id.TrackId 
CmdRuler Id.RulerId 
CmdBringToFront Id.ViewId 
CmdTitleFocus Id.ViewId (Maybe Types.TrackNum)

If the TrackNum is set, set keyboard focus on that track's title. Otherwise, focus on the block title.

data Update t u Source #


View !Id.ViewId !View 
Block !Id.BlockId !(Block t) 
Track !Id.TrackId !Track 
Ruler !Id.RulerId

Since I expect rulers to be changed infrequently, the only kind of ruler update is a full update.

State !u 


(Eq u, Eq t) => Eq (Update t u) # 


(==) :: Update t u -> Update t u -> Bool #

(/=) :: Update t u -> Update t u -> Bool #

(Show u, Show t) => Show (Update t u) # 


showsPrec :: Int -> Update t u -> ShowS #

show :: Update t u -> String #

showList :: [Update t u] -> ShowS #

DeepSeq.NFData (Update t u) # 


rnf :: Update t u -> () #

(Pretty.Pretty t, Pretty.Pretty u) => Pretty.Pretty (Update t u) # 


pretty :: Update t u -> Text Source #

format :: Update t u -> Doc Source #

formatList :: [Update t u] -> Doc Source #

data View Source #


ViewSize !Rect.Rect 
Status !(Map (Int, Text) Text) !Color.Color

background color

TrackScroll !Types.Width 
Zoom !Zoom.Zoom 
Selection !Sel.Num !(Maybe Sel.Selection) 

Bring the window to the front. Unlike most other updates, this is recorded directly and is not reflected in Ui.State.

TitleFocus !(Maybe Types.TrackNum)

Similar to BringToFront, but sets keyboard focus in a track title. If the TrackNum is not given, focus on the block title.


Eq View # 


(==) :: View -> View -> Bool #

(/=) :: View -> View -> Bool #

Show View # 


showsPrec :: Int -> View -> ShowS #

show :: View -> String #

showList :: [View] -> ShowS #

Pretty.Pretty View # 

data Block t Source #


BlockTitle !Text 
BlockConfig !Block.Config 
BlockSkeleton !Skeleton.Skeleton ![(Color.Color, [(Types.TrackNum, Types.TrackNum)])]

The second is the "integrate skeleton", which is drawn in the same place. It could be Skeleton too, but since it never was a skeleton it seems pointless to convert it to one just so it can be flattened again. Arguably it's the first arg which should be edges, but at least this way the two args can't be mixed up.

RemoveTrack !Types.TrackNum 
InsertTrack !Types.TrackNum !t 
BlockTrack !Types.TrackNum !t

Unlike Track, these settings are local to the block, not global to this track in all its blocks.


Eq t => Eq (Block t) # 


(==) :: Block t -> Block t -> Bool #

(/=) :: Block t -> Block t -> Bool #

Show t => Show (Block t) # 


showsPrec :: Int -> Block t -> ShowS #

show :: Block t -> String #

showList :: [Block t] -> ShowS #

Pretty.Pretty t => Pretty.Pretty (Block t) # 

data Track Source #


TrackEvents !ScoreTime !ScoreTime

Low pos, high pos.


Update the entire track.

TrackTitle !Text 
TrackBg !Color.Color 
TrackRender !Track.RenderConfig 


to_display :: UiUpdate -> Maybe DisplayUpdate Source #

Convert a UiUpdate to a DisplayUpdate by stripping out all the UiUpdate parts.

to_cmd :: UiUpdate -> Maybe CmdUpdate Source #

Pull the CmdUpdate out of a UiUpdate, if any. Discard BringToFront and TitleFocus since they're just instructions to Sync and I don't need to remember them.


is_view_update :: UiUpdate -> Bool Source #

Updates which purely manipulate the view are not recorded by undo.

is_score_update :: CmdUpdate -> Bool Source #

True if this CmdUpdate implies score damage.

collapse_updates :: [Update t u] -> [Update t u] Source #

TrackUpdates can overlap. Merge them together here. Technically I can also cancel out all TrackUpdates that only apply to newly created views, but this optimization is probably not worth it.

track_changed :: UiUpdate -> Maybe (Id.TrackId, Ranges.Ranges ScoreTime) Source #

Does an update imply a change which would require rederiving?

sort :: [DisplayUpdate] -> [DisplayUpdate] Source #

Some Updates have to happen before others.