, _custom_device_mode(string())
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*group))
- , _diff_command(0)
+ , _note_diff_command (0)
, _ghost_note(0)
, _drag_rect (0)
, _step_edit_cursor (0)
, _custom_device_mode(string())
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*parent))
- , _diff_command(0)
+ , _note_diff_command (0)
, _ghost_note(0)
, _drag_rect (0)
, _step_edit_cursor (0)
, _custom_device_mode(string())
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*get_canvas_group()))
- , _diff_command(0)
+ , _note_diff_command (0)
, _ghost_note(0)
, _drag_rect (0)
, _step_edit_cursor (0)
, _custom_device_mode(string())
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*get_canvas_group()))
- , _diff_command(0)
+ , _note_diff_command (0)
, _ghost_note(0)
, _drag_rect (0)
, _step_edit_cursor (0)
view->update_note_range(new_note->note());
- MidiModel::DiffCommand* cmd = _model->new_diff_command("add note");
- cmd->add(new_note);
+ MidiModel::NoteDiffCommand* cmd = _model->new_note_diff_command("add note");
+ cmd->add (new_note);
_model->apply_command(*trackview.session(), cmd);
play_midi_note (new_note);
}
void
-MidiRegionView::start_diff_command(string name)
+MidiRegionView::start_note_diff_command (string name)
{
- if (!_diff_command) {
- _diff_command = _model->new_diff_command(name);
+ if (!_note_diff_command) {
+ _note_diff_command = _model->new_note_diff_command (name);
}
}
void
-MidiRegionView::diff_add_note(const boost::shared_ptr<NoteType> note, bool selected, bool show_velocity)
+MidiRegionView::note_diff_add_note (const boost::shared_ptr<NoteType> note, bool selected, bool show_velocity)
{
- if (_diff_command) {
- _diff_command->add(note);
+ if (_note_diff_command) {
+ _note_diff_command->add (note);
}
if (selected) {
_marked_for_selection.insert(note);
}
void
-MidiRegionView::diff_remove_note(ArdourCanvas::CanvasNoteEvent* ev)
+MidiRegionView::note_diff_remove_note (ArdourCanvas::CanvasNoteEvent* ev)
{
- if (_diff_command && ev->note()) {
- _diff_command->remove(ev->note());
+ if (_note_diff_command && ev->note()) {
+ _note_diff_command->remove(ev->note());
}
}
void
-MidiRegionView::diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
- MidiModel::DiffCommand::Property property,
- uint8_t val)
+MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
+ MidiModel::NoteDiffCommand::Property property,
+ uint8_t val)
{
- if (_diff_command) {
- _diff_command->change (ev->note(), property, val);
+ if (_note_diff_command) {
+ _note_diff_command->change (ev->note(), property, val);
}
}
void
-MidiRegionView::diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
- MidiModel::DiffCommand::Property property,
- Evoral::MusicalTime val)
+MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
+ MidiModel::NoteDiffCommand::Property property,
+ Evoral::MusicalTime val)
{
- if (_diff_command) {
- _diff_command->change (ev->note(), property, val);
+ if (_note_diff_command) {
+ _note_diff_command->change (ev->note(), property, val);
}
}
{
bool add_or_remove;
- if (!_diff_command) {
+ if (!_note_diff_command) {
return;
}
- if ((add_or_remove = _diff_command->adds_or_removes())) {
+ if ((add_or_remove = _note_diff_command->adds_or_removes())) {
// Mark all selected notes for selection when model reloads
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
_marked_for_selection.insert((*i)->note());
}
}
- _model->apply_command(*trackview.session(), _diff_command);
- _diff_command = 0;
+ _model->apply_command(*trackview.session(), _note_diff_command);
+ _note_diff_command = 0;
midi_view()->midi_track()->playlist_modified();
if (add_or_remove) {
}
void
-MidiRegionView::apply_diff_as_subcommand()
+MidiRegionView::apply_diff_as_subcommand ()
{
bool add_or_remove;
- if (!_diff_command) {
+ if (!_note_diff_command) {
return;
}
- if ((add_or_remove = _diff_command->adds_or_removes())) {
+ if ((add_or_remove = _note_diff_command->adds_or_removes())) {
// Mark all selected notes for selection when model reloads
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
_marked_for_selection.insert((*i)->note());
}
}
- _model->apply_command_as_subcommand(*trackview.session(), _diff_command);
- _diff_command = 0;
+ _model->apply_command_as_subcommand(*trackview.session(), _note_diff_command);
+ _note_diff_command = 0;
midi_view()->midi_track()->playlist_modified();
if (add_or_remove) {
void
MidiRegionView::abort_command()
{
- delete _diff_command;
- _diff_command = 0;
+ delete _note_diff_command;
+ _note_diff_command = 0;
clear_selection();
}
clear_events();
delete _note_group;
- delete _diff_command;
+ delete _note_diff_command;
delete _step_edit_cursor;
delete _temporary_note_group;
}
_marked_for_selection.clear ();
clear_selection ();
- start_diff_command (_("step add"));
- diff_add_note (new_note, true, false);
+ start_note_diff_command (_("step add"));
+ note_diff_add_note (new_note, true, false);
apply_diff();
// last_step_edit_note = new_note;
return;
}
- start_diff_command (_("delete selection"));
+ start_note_diff_command (_("delete selection"));
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
if ((*i)->selected()) {
- _diff_command->remove((*i)->note());
+ _note_diff_command->remove((*i)->note());
}
}
void
MidiRegionView::delete_note (boost::shared_ptr<NoteType> n)
{
- start_diff_command (_("delete note"));
- _diff_command->remove (n);
+ start_note_diff_command (_("delete note"));
+ _note_diff_command->remove (n);
apply_diff ();
trackview.editor().hide_verbose_canvas_cursor ();
highest_note_difference = highest_note_in_selection - 127;
}
- start_diff_command(_("move notes"));
+ start_note_diff_command (_("move notes"));
for (Selection::iterator i = _selection.begin(); i != _selection.end() ; ++i) {
continue;
}
- diff_add_change (*i, MidiModel::DiffCommand::StartTime, new_time);
+ note_diff_add_change (*i, MidiModel::NoteDiffCommand::StartTime, new_time);
uint8_t original_pitch = (*i)->note()->note();
uint8_t new_pitch = original_pitch + dnote - highest_note_difference;
lowest_note_in_selection = std::min(lowest_note_in_selection, new_pitch);
highest_note_in_selection = std::max(highest_note_in_selection, new_pitch);
- diff_add_change (*i, MidiModel::DiffCommand::NoteNumber, new_pitch);
+ note_diff_add_change (*i, MidiModel::NoteDiffCommand::NoteNumber, new_pitch);
}
apply_diff();
void
MidiRegionView::commit_resizing (ArdourCanvas::CanvasNote* primary, bool at_front, double delta_x, bool relative)
{
- start_diff_command(_("resize notes"));
+ start_note_diff_command (_("resize notes"));
for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
CanvasNote* canvas_note = (*i)->canvas_note;
current_x = frames_to_beats (current_x);
if (at_front && current_x < canvas_note->note()->end_time()) {
- diff_add_change (canvas_note, MidiModel::DiffCommand::StartTime, current_x);
+ note_diff_add_change (canvas_note, MidiModel::NoteDiffCommand::StartTime, current_x);
double len = canvas_note->note()->time() - current_x;
len += canvas_note->note()->length();
if (len > 0) {
/* XXX convert to beats */
- diff_add_change (canvas_note, MidiModel::DiffCommand::Length, len);
+ note_diff_add_change (canvas_note, MidiModel::NoteDiffCommand::Length, len);
}
}
if (len > 0) {
/* XXX convert to beats */
- diff_add_change (canvas_note, MidiModel::DiffCommand::Length, len);
+ note_diff_add_change (canvas_note, MidiModel::NoteDiffCommand::Length, len);
}
}
void
MidiRegionView::change_note_channel (CanvasNoteEvent* event, int8_t channel)
{
- diff_add_change (event, MidiModel::DiffCommand::Channel, (uint8_t) channel);
+ note_diff_add_change (event, MidiModel::NoteDiffCommand::Channel, (uint8_t) channel);
}
void
event->set_selected (event->selected()); // change color
- diff_add_change (event, MidiModel::DiffCommand::Velocity, new_velocity);
+ note_diff_add_change (event, MidiModel::NoteDiffCommand::Velocity, new_velocity);
}
void
}
clamp_to_0_127 (new_note);
- diff_add_change (event, MidiModel::DiffCommand::NoteNumber, new_note);
+ note_diff_add_change (event, MidiModel::NoteDiffCommand::NoteNumber, new_note);
}
void
}
if (change_start) {
- diff_add_change (event, MidiModel::DiffCommand::StartTime, new_start);
+ note_diff_add_change (event, MidiModel::NoteDiffCommand::StartTime, new_start);
}
if (change_length) {
- diff_add_change (event, MidiModel::DiffCommand::Length, new_length);
+ note_diff_add_change (event, MidiModel::NoteDiffCommand::Length, new_length);
}
}
new_time = delta;
}
- diff_add_change (event, MidiModel::DiffCommand::StartTime, new_time);
+ note_diff_add_change (event, MidiModel::NoteDiffCommand::StartTime, new_time);
}
void
MidiRegionView::change_note_length (CanvasNoteEvent* event, Evoral::MusicalTime t)
{
- diff_add_change (event, MidiModel::DiffCommand::Length, t);
+ note_diff_add_change (event, MidiModel::NoteDiffCommand::Length, t);
}
void
}
}
- start_diff_command(_("change velocities"));
+ start_note_diff_command (_("change velocities"));
for (Selection::iterator i = _selection.begin(); i != _selection.end();) {
Selection::iterator next = i;
}
}
- start_diff_command (_("transpose"));
+ start_note_diff_command (_("transpose"));
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ) {
Selection::iterator next = i;
delta = -delta;
}
- start_diff_command (_("change note lengths"));
+ start_note_diff_command (_("change note lengths"));
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ) {
Selection::iterator next = i;
delta = -delta;
}
- start_diff_command (_("nudge"));
+ start_note_diff_command (_("nudge"));
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ) {
Selection::iterator next = i;
void
MidiRegionView::change_channel(uint8_t channel)
{
- start_diff_command(_("change channel"));
+ start_note_diff_command(_("change channel"));
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
- diff_add_change (*i, MidiModel::DiffCommand::Channel, channel);
+ note_diff_add_change (*i, MidiModel::NoteDiffCommand::Channel, channel);
}
apply_diff();
if (op != Copy) {
- start_diff_command();
+ start_note_diff_command();
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
switch (op) {
break;
case Cut:
case Clear:
- diff_remove_note (*i);
+ note_diff_remove_note (*i);
break;
}
}
return;
}
- start_diff_command (_("paste"));
+ start_note_diff_command (_("paste"));
Evoral::MusicalTime beat_delta;
Evoral::MusicalTime paste_pos_beats;
/* make all newly added notes selected */
- diff_add_note (copied_note, true);
+ note_diff_add_note (copied_note, true);
end_point = copied_note->end_time();
}
_note_group->reparent (*group);
delete _temporary_note_group;
_temporary_note_group = 0;
+
+ if (_region->start() < 0) {
+ /* Trim drag made start time -ve; fix this */
+ midi_region()->fix_negative_start ();
+ }
}