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

Safe HaskellNone





data Ruler Source #

A Ruler contains all the data to display a ruler.





type Marklists = Map Name (Maybe MeterType, Marklist) 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.

meter_ruler :: Maybe MeterType -> Marklist -> Ruler Source #

Create a ruler with just a meter marklist.

meter :: Name Source #

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.

no_ruler :: Ruler Source #

Empty ruler.

modify_marklist :: Name -> (Maybe MeterType -> Marklist -> Marklist) -> Ruler -> Ruler Source #

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

time_end :: Ruler -> ScoreTime Source #

Get the position of the last mark of the ruler.


bounds :: Name Source #

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.

bounds_of :: Ruler -> (ScoreTime, Maybe ScoreTime) Source #

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_fptr :: Marklist -> MarklistPtr 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.

ascending :: ScoreTime -> Marklist -> [PosMark] Source #

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

descending :: ScoreTime -> Marklist -> [PosMark] Source #

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

marklist_end :: Marklist -> ScoreTime Source #

Get the position of the last mark.



data Mark Source #




  • mark_rank :: !Rank

    An 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 :: !Int

    Width in pixels.

  • mark_color :: !Color.Color
  • mark_name :: !Text

    A bit of text displayed with the mark. This can use backtick symbols.

  • mark_name_zoom_level :: !Double

    The text is only displayed when the zoom factor exceeds this value.

  • mark_zoom_level :: !Double

    The mark itself is only displayed when the zoom factor exeeds this value.

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.