Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

Ui.Diff

Description

Diff two states to produce a list of Updates, which must be sent to the UI to make it display the second state.

This is unpleasantly complicated and subtle. I wish I knew a better way!

Synopsis

Documentation

diff :: Update.UiDamage -> Ui.State -> Ui.State -> ([Update.UiUpdate], [Update.DisplayUpdate]) Source #

Figure out updates needed to turn st1 into st2.

derive_diff :: Ui.State -> Ui.State -> Update.UiDamage -> [Update.UiUpdate] -> Derive.ScoreDamage Source #

This diff is meant to determine score damage for the block, which determines what will have to be rederived, if anything.

This is repeating some work done in diff, but is fundamentally different because it cares about nonvisible changes, e.g. track title change on a block without a view.

track_diff :: Ui.State -> Ui.State -> TrackId -> Update.UiDamage Source #

Diff the events on one track. This will only emit track damage, and won't emit anything if the track title changed, or was created or deleted. Those diffs should be picked up by the main diff.

score_changed :: Ui.State -> Ui.State -> Update.UiDamage -> Bool Source #

This is like derive_diff, but it only needs to return a Bool. It's also more sensitive in that it's looking for any change that you might want to save to disk, not just changes that could require rederivation.