Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Ui.Update

Contents

Description

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.

Synopsis

Documentation

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.

Constructors

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.

Instances
Eq CmdUpdate # 
Instance details

Defined in Ui.Update

Show CmdUpdate # 
Instance details

Defined in Ui.Update

Pretty.Pretty CmdUpdate # 
Instance details

Defined in Ui.Update

data Update t u Source #

Constructors

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 
Instances
(Eq t, Eq u) => Eq (Update t u) # 
Instance details

Defined in Ui.Update

Methods

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

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

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

Defined in Ui.Update

Methods

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

show :: Update t u -> String #

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

DeepSeq.NFData (Update t u) # 
Instance details

Defined in Ui.Update

Methods

rnf :: Update t u -> () #

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

Defined in Ui.Update

Methods

pretty :: Update t u -> Text Source #

format :: Update t u -> Doc Source #

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

data View Source #

Constructors

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

background color

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

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.

Instances
Eq View # 
Instance details

Defined in Ui.Update

Methods

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

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

Show View # 
Instance details

Defined in Ui.Update

Methods

showsPrec :: Int -> View -> ShowS #

show :: View -> String #

showList :: [View] -> ShowS #

Pretty.Pretty View # 
Instance details

Defined in Ui.Update

data Block t Source #

Constructors

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.

Instances
Eq t => Eq (Block t) # 
Instance details

Defined in Ui.Update

Methods

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

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

Show t => Show (Block t) # 
Instance details

Defined in Ui.Update

Methods

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

show :: Block t -> String #

showList :: [Block t] -> ShowS #

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

Defined in Ui.Update

data Track Source #

Constructors

TrackEvents !ScoreTime !ScoreTime

Low pos, high pos.

TrackAllEvents

Update the entire track.

TrackTitle !Text 
TrackBg !Color.Color 
TrackRender !Track.RenderConfig 
Instances
Eq Track # 
Instance details

Defined in Ui.Update

Methods

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

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

Show Track # 
Instance details

Defined in Ui.Update

Methods

showsPrec :: Int -> Track -> ShowS #

show :: Track -> String #

showList :: [Track] -> ShowS #

Pretty.Pretty Track # 
Instance details

Defined in Ui.Update

data State Source #

These are updates to State that have no UI presence.

Instances
Eq State # 
Instance details

Defined in Ui.Update

Methods

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

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

Show State # 
Instance details

Defined in Ui.Update

Methods

showsPrec :: Int -> State -> ShowS #

show :: State -> String #

showList :: [State] -> ShowS #

Pretty.Pretty State # 
Instance details

Defined in Ui.Update

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.

functions

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.