Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Cmd.Ruler.RulerUtil

Description

Infrastructure for dealing with rulers in a higher level way.

Synopsis

generate

meter_until :: Meter.AbstractMeter -> TrackTime -> Int -> TrackTime -> Meter.Meter Source #

Make a ruler of a single meter until the given end time.

by marklist

copy_marklist :: Ui.M m => Ruler.Name -> Id.RulerId -> Id.RulerId -> m () Source #

Copy a marklist from one ruler to another. If it already exists in the destination ruler, it will be replaced.

set_marklist :: Ui.M m => Id.RulerId -> Ruler.Name -> Mark.Marklist -> m () Source #

Replace or add a marklist with the given name.

by Meter

ModifyRuler

data Scope Source #

The scope of a ruler modification.

Constructors

Block

Modify all rulers on the block.

Section !TrackNum

Modify the section_ruler_id. Section 0 is the Ui.block_ruler.

Tracks ![TrackNum]

Modify the given tracks.

Instances

Instances details
Show Scope Source # 
Instance details

Defined in Cmd.Ruler.RulerUtil

Methods

showsPrec :: Int -> Scope -> ShowS #

show :: Scope -> String #

showList :: [Scope] -> ShowS #

Eq Scope Source # 
Instance details

Defined in Cmd.Ruler.RulerUtil

Methods

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

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

replace :: Ui.M m => Id.BlockId -> ModifyRuler -> m Id.RulerId Source #

Create or replace a ruler for the given block.

local

local :: Ui.M m => Scope -> Id.BlockId -> ModifyRuler -> m [Id.RulerId] Source #

Modify a ruler or rulers, making copies if they're shared outside of the Scope.

local_meter :: Ui.M m => Scope -> Id.BlockId -> (Meter.Meter -> Meter.Meter) -> m [Id.RulerId] Source #

Like local, but specialized to modify the meter.

local_section Source #

Arguments

:: Ui.M m 
=> Id.BlockId 
-> TrackNum

Modify the section_ruler_id of this track.

-> ModifyRuler 
-> m Id.RulerId 

local_tracks :: Ui.M m => Id.BlockId -> [TrackNum] -> ModifyRuler -> m [Id.RulerId] Source #

Modify the given tracks, making copies if they're shared with other tracks.

local_ruler :: Ui.M m => Scope -> Id.BlockId -> Id.RulerId -> ModifyRuler -> m Id.RulerId Source #

Modify the given RulerId, making a copy if it's shared with another block.

rulers_in_scope Source #

Arguments

:: Ui.M m 
=> Scope 
-> Id.BlockId 
-> Id.RulerId 
-> m ([TrackNum], Bool)

(tracknums with the RulerId and in the scope, True if there are ones out of scope)

modify_copy :: Ui.M m => Id.BlockId -> Id.RulerId -> ModifyRuler -> m Id.RulerId Source #

Copy the ruler and modify the copy.

modify

modify :: Ui.M m => Scope -> Id.BlockId -> ModifyRuler -> m () Source #

Modify the ruler on the focused block. Other blocks with the same ruler will also be modified.

modify_block :: Ui.M m => Id.BlockId -> ModifyRuler -> m () Source #

Modify all rulers in the block.

modify_section :: Ui.M m => Id.BlockId -> TrackNum -> ModifyRuler -> m () Source #

Modify all rulers on the block in this section_ruler_id.

modify_ruler Source #

Arguments

:: Ui.M m 
=> Id.BlockId 
-> [TrackNum]

If given, these are the TrackIds that were intended to be modified. This is necessary if you try to modify Ui.no_ruler.

-> Id.RulerId 
-> ModifyRuler 
-> m () 

util

section_ruler_id :: Ui.M m => Id.BlockId -> TrackNum -> m Id.RulerId Source #

The section RulerId is the first ruler of the section. A section is defined by get_section, but in a normal block with one ruler track at tracknum 0, it will be tracknum 0.

get_section :: Ui.M m => Id.BlockId -> TrackNum -> m [(TrackNum, Block.TracklikeId)] Source #

Get the tracks of the section of the given track. A section extends from a ruler track until the next ruler track.

block_id_to_ruler :: Id.BlockId -> Id.Id Source #

Create a block-local RulerId. It gets the exact same name as the block, but is defined as a function so it's clear where this conversion is done.