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

Cmd.Edit

Description

Event editing commands. This is where generic event editing commands go. More specialized ones, like copy and paste and control or note track commands, go in their own modules.

Synopsis

global editing state

cmd_toggle_val_edit :: Cmd.M m => m () Source #

Unlike the other toggle commands, val edit, being the "default" toggle, always turns other modes off. So you can't switch directly from some other kind of edit to val edit.

cmd_toggle_kbd_entry :: Cmd.M m => m () Source #

Toggle kbd entry mode, putting a K in the edit box as a reminder. This is orthogonal to the previous edit modes.

set_step_rank :: Cmd.M m => TimeStep.TimeStep -> Ruler.Rank -> m () Source #

If the TimeStep is AbsoluteMark or RelativeMark, set its rank. Otherwise, set it to the deflt. This means the marklist names are sticky, so if you set it manually the default bindings won't mess it up.

toggle_absolute_relative_step :: Cmd.M m => m () Source #

Toggle between absolute and relative mark step.

toggle_chord :: Cmd.M m => m () Source #

event start and duration

cmd_move_event_forward :: Cmd.M m => m () Source #

Different from cmd_insert_time and cmd_delete_time since it only modifies one event. Move back the next event, or move forward the previous event. If the selection is non-zero, the event's duration will be modified to the selection.

cmd_set_duration :: Cmd.M m => m () Source #

Extend the events in the selection to either the end of the selection or the beginning of the next note, whichever is shorter.

If the selection is on an event, the previous or next one (depending on Types.Orientation) is extended instead. This is more useful than reducing the event to 0, which has its own cmd anyway. If the selection is between a positive and negative event, the one corresponding to Sel.orientation is selected.

cmd_toggle_zero_timestep :: Cmd.M m => m () Source #

Toggle duration between zero and non-zero.

If the event is non-zero, then make it zero. Otherwise, set its end to the cursor. Unless the cursor is on the event start, and then extend it by a timestep.

Also I previously used the same event selection strategy as cmd_set_duration, which avoided the awkward point selection on zero-dur event case, but it turned out to be unintuitive to use in practice, because to toggle an event I'd have to put the selection on the next event.

cmd_set_start :: Cmd.M m => m () Source #

Move only the beginning of an event. As is usual for zero duration events, their duration will not be changed so this is equivalent to a move.

Other cmds are biased towards the previous event, i.e. they affect the previous event if nothing is selected. This cmd is a little different: if it overlaps with an event, it will affect that one. Otherwise, it affects the next positive event or the previous negative event. The idea is that it's not very useful to clip an event to 0 by moving it past its end, so let's not do that. So it's like set_duration backwards: at does nothing, otherwise get next positive or prev negative.

Unlike cmd_set_duration, I can't think of a way for this to make sense with a non-point selection, so it uses the point position.

TODO for zero duration events, this is equivalent to cmd_move_event_backward. I'm not totally happy about the overlap, is there a more orthogonal organization?

modify_dur :: Cmd.M m => (ScoreTime.ScoreTime -> ScoreTime.ScoreTime) -> m () Source #

Modify event durations by applying a function to them. 0 durations are passed through, so you can't accidentally give control events duration.

cmd_join_events :: Cmd.M m => m () Source #

If there is a following event, delete it and extend this one to its end.

Since 0 dur events are never lengthened, joining control events simply deletes the later ones.

If it's a point, only join up to (and including) the nearest event start. Otherwise, if there's a collapsed pitch track and the next event doesn't have a pitch event, it's easy to wind up deleting a distance pitch and not noticing.

cmd_split_events :: Cmd.M m => m () Source #

Split the events under the cursor.

cmd_insert_time :: Cmd.M m => m () Source #

Insert empty space at the beginning of the selection for the length of the selection, pushing subsequent events forwards. If the selection is a point, insert one timestep.

cmd_delete_time :: Cmd.M m => m () Source #

Remove the notes under the selection, and move everything else back. If the selection is a point, delete one timestep.

delete_block_time :: Ui.M m => BlockId -> ScoreTime.TrackTime -> ScoreTime.TrackTime -> m () Source #

Delete the time range for all tracks in the block.

cmd_clear_selected :: Cmd.M m => m () Source #

If the insertion selection is a point, clear any event under it. If it's a range, clear all events within its half-open extent.

toggle_note_duration :: Cmd.M m => m () Source #

Toggle the note duration between the end of the block, and the current time step.

modify text

strip_transformer :: Cmd.M m => m () Source #

Strip off the first transformer, and then the generator.

record action

run_action_at :: Cmd.M m => Char -> m () Source #

floating text input

handle_floating_input Source #

Arguments

:: Cmd.M m 
=> Bool

True to always create a zero duration event.

-> Msg.Msg 
-> m Cmd.Status 

Handle UpdateInput that comes back from the floating input.

A leading space will create a zero duration event.

replace_first_call :: Cmd.M m => m Cmd.Status Source #

This will be fooled by a | inside a string, but I'll fix that if it's ever actually a problem.