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

Ui.Ruler

Synopsis

# Ruler

data Ruler Source #

A Ruler contains all the data to display a ruler.

Constructors

 Ruler Fieldsruler_marklists :: !Marklists ruler_bg :: !Color.Color ruler_show_names :: !BoolShow the names if this is on an event track. Ruler tracks always show the names.ruler_align_to_bottom :: !BoolAlign bottoms of marks to beats, instead of the top. Looks good used with negative duration events (arrival beats).

Instances

 # Methods(==) :: Ruler -> Ruler -> Bool #(/=) :: Ruler -> Ruler -> Bool # # MethodsshowsPrec :: Int -> Ruler -> ShowS #show :: Ruler -> String #showList :: [Ruler] -> ShowS # # Methodsrnf :: Ruler -> () # # MethodsformatList :: [Ruler] -> Doc Source #

Each ruler can have multiple named marklists. This means a ruler can have multiple simultaneous meters, or a separate list of ad-hoc cue points. All marks are flattened before display, and are drawn in the sort order of their Names.

type Name = Text Source #

type MeterType = Text Source #

The type of meter that this marklist represents. This is looked up in a table of meter types to figure out how to do transformations on the meter, since different meters follow different rules.

ruler :: [(Name, (Maybe MeterType, Marklist))] -> Ruler Source #

Constructor for "plain" rulers.

Create a ruler with just a meter marklist.

The meter marklist by convention has marks corresponding to the meter of the piece. Other commands may use this to find out where beats are.

Empty ruler.

If the marklist isn't set, modify will be given an empty one.

Get the position of the last mark of the ruler.

## bounds

Marks on this marklist given the logical block bounds. If there is one mark, it denotes the logical block end. Two morks mean the first one is the logical block start. The mark text doesn't matter, but s and e are customary.

Get block bounds as defined by the ruler. This uses explicit bounds if there are any, otherwise it uses the meter. Otherwise, the start time can default to 0, but the end time defaults to Nothing so the caller can use the end of the last event.

# Marklist

data Marklist Source #

Instances

 # Methods # MethodsshowList :: [Marklist] -> ShowS # # MethodsformatList :: [Marklist] -> Doc Source #

This is a cache for the C-marshalled version of the marklist. It will be allocated if the Marklist is passed to C, and is managed with its own reference count.

I think this should be safe as long as marklist is the only constructor.

Marks starting at the first mark >= the given pos, to the end.

Marks starting at the first mark below the given pos, to the beginning.

Get the position of the last mark.

# Mark

data Mark Source #

Constructors

 Mark Fieldsmark_rank :: !RankAn arbitrary low integer. This is the only part of the mark that matters to the code, the rest is purely visual. By convention, the most prominent divisions start at rank 0 and go up from there.mark_width :: !IntWidth in pixels.mark_color :: !Color.Color mark_name :: !TextA bit of text displayed with the mark. This can use backtick symbols.mark_name_zoom_level :: !DoubleThe text is only displayed when the zoom factor exceeds this value.mark_zoom_level :: !DoubleThe mark itself is only displayed when the zoom factor exeeds this value.

Instances

 # Methods(==) :: Mark -> Mark -> Bool #(/=) :: Mark -> Mark -> Bool # # Methods # MethodsshowsPrec :: Int -> Mark -> ShowS #show :: Mark -> String #showList :: [Mark] -> ShowS # # Methodsrnf :: Mark -> () # # MethodsformatList :: [Mark] -> Doc Source #

type Rank = Int Source #

# for RulerC's eyes only

newtype MarklistPtr Source #

This should be opaque, but it needs to be exported for RulerC. Don't look inside if you're not RulerC, OK?

The Left value is actually not used, but prevents the unsafePerformIO from being floated out of the lambda.

I used to just copy the ruler each time, but it was actually pretty big. Rulers can have lots of marks, there are many rulers per block since each track has one. But many tracks share the same ruler, and they change rarely. All of these differences from Events push for passing by pointer rather than copying over the whole thing each time (as with the signal), or passing a callback that fetches the required range (as with events).

TODO I could share the memory by making MarklistVector into Vector.Storable PosMark. It's otherwise equivalant though, and the number of distinct rulers is probably small, so the memory savings doesn't seem that compelling.

Constructors

 MarklistPtr (MVar.MVar (Either MarklistVector (ForeignPtr Marklist)))