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

Safe HaskellNone

Cmd.Edit

Contents

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.

util

modify_advance :: Cmd.M m => (Bool -> Bool) -> m () Source #

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

modify_chord :: Cmd.M m => (Bool -> Bool) -> m () Source #

event start and duration

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

Insert an event at the current insert pos.

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 Event.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.

modify_event_near_point :: Cmd.M m => ((ScoreTime.ScoreTime, ScoreTime.ScoreTime) -> Event.Event -> Event.Event) -> m () Source #

Similar to ModifyEvents.event, but if the selection is a point, modify the previous or next event, depending on if it's positive or negative.

avoid_exact_match :: Cmd.M m => m [(TrackId, Event.Event)] Source #

Like Selection.events_around, but if a point selection is on an event start, find a neighbor instead of matching that event.

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.

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

Split the events under the cursor.

set_dur :: ScoreTime.TrackTime -> Event.Event -> Event.Event Source #

The same as set_duration except don't modify a zero dur event.

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.

insert_event_time :: ScoreTime.TrackTime -> ScoreTime.TrackTime -> Event.Event -> Event.Event Source #

Modify the event to insert time, lengthening it if the start time falls within the event's duration.

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.

delete_event_time :: ScoreTime.TrackTime -> ScoreTime.TrackTime -> Event.Event -> Maybe Event.Event Source #

Modify the event to delete time, shortening it the start time falls within the event's duration, or removing it entirely if its Event.start was deleted.

This is more complicated than insert_event_time because it can delete events, and because the event may only be partially shortened if the range overlaps its end.

point_to_timestep :: Cmd.M m => [TrackNum] -> ScoreTime.TrackTime -> ScoreTime.TrackTime -> m (ScoreTime.TrackTime, ScoreTime.TrackTime) Source #

If the range is a point, then expand it to one timestep.

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.

fancier start/duration edits

set_call_duration :: Cmd.M m => BlockId -> TrackId -> Event.Event -> m Event.Event Source #

Set the event duration to the CallDuration of its call. For block calls, this is the natural block duration.

lookup_call_duration :: Cmd.M m => BlockId -> TrackId -> Event.Event -> m (Maybe ScoreTime.TrackTime) Source #

Evaluate the given event to find its get_call_duration.

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

modify text

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

Strip off the first transformer, and then the generator.

record action

make_action :: Maybe Text -> Text -> Maybe ScoreTime.TrackTime -> Cmd.Action Source #

If you create a new event, and there is explicit duration, then use it.

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

floating text input

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.

edit_point :: Sel.Selection -> ScoreTime.TrackTime Source #

If a selection is used to create an event, this is where the event's start is.

open_floating :: Cmd.M m => (Text -> (Int, Int)) -> m Cmd.Status Source #

Open a floating text entry with a selection set.

handle floating input msg

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.

try_set_call_duration :: Cmd.M m => BlockId -> TrackId -> ScoreTime.TrackTime -> Event.Orientation -> m () Source #

Set the event's duration to its CallDuration, if it has one.