bool shorter = Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier);
bool fine = Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier);
- change_note_lengths (fine, shorter, start, end);
+ change_note_lengths (fine, shorter, 0.0, start, end);
return true;
void
MidiRegionView::step_add_note (uint8_t channel, uint8_t number, uint8_t velocity,
- Evoral::MusicalTime pos, Evoral::MusicalTime len)
+ Evoral::MusicalTime pos, Evoral::MusicalTime len)
{
boost::shared_ptr<NoteType> new_note (new NoteType (channel, pos, len, number, velocity));
// last_step_edit_note = new_note;
}
+void
+MidiRegionView::step_sustain (Evoral::MusicalTime beats)
+{
+ change_note_lengths (false, false, beats, false, true);
+}
+
void
MidiRegionView::add_pgm_change(PCEvent& program, const string& displaytext)
{
}
void
-MidiRegionView::note_dropped(CanvasNoteEvent *, double dt, int8_t dnote)
+MidiRegionView::note_dropped(CanvasNoteEvent *, frameoffset_t dt, int8_t dnote)
{
assert (!_selection.empty());
for (Selection::iterator i = _selection.begin(); i != _selection.end() ; ++i) {
- nframes64_t start_frames = beats_to_frames((*i)->note()->time());
-
- if (dt >= 0) {
- start_frames += snap_frame_to_frame(trackview.editor().pixel_to_frame(dt));
- } else {
- start_frames -= snap_frame_to_frame(trackview.editor().pixel_to_frame(-dt));
- }
-
- Evoral::MusicalTime new_time = frames_to_beats(start_frames);
+ Evoral::MusicalTime new_time = frames_to_beats (beats_to_frames ((*i)->note()->time()) + dt);
if (new_time < 0) {
continue;
apply_diff();
}
+void
+MidiRegionView::change_note_channel (CanvasNoteEvent* event, int8_t channel)
+{
+ diff_add_change (event, MidiModel::DiffCommand::Channel, (uint8_t) channel);
+}
+
void
MidiRegionView::change_note_velocity(CanvasNoteEvent* event, int8_t velocity, bool relative)
{
diff_add_change (event, MidiModel::DiffCommand::StartTime, new_time);
}
+void
+MidiRegionView::change_note_length (CanvasNoteEvent* event, Evoral::MusicalTime t)
+{
+ diff_add_change (event, MidiModel::DiffCommand::Length, t);
+}
+
void
MidiRegionView::change_velocities (bool up, bool fine, bool allow_smush)
{
}
void
-MidiRegionView::change_note_lengths (bool fine, bool shorter, bool start, bool end)
+MidiRegionView::change_note_lengths (bool fine, bool shorter, Evoral::MusicalTime delta, bool start, bool end)
{
- Evoral::MusicalTime delta;
-
- if (fine) {
- delta = 1.0/128.0;
- } else {
- /* grab the current grid distance */
- bool success;
- delta = trackview.editor().get_grid_type_as_beats (success, _region->position());
- if (!success) {
- /* XXX cannot get grid type as beats ... should always be possible ... FIX ME */
- cerr << "Grid type not available as beats - TO BE FIXED\n";
- return;
- }
- }
+ if (delta == 0.0) {
+ if (fine) {
+ delta = 1.0/128.0;
+ } else {
+ /* grab the current grid distance */
+ bool success;
+ delta = trackview.editor().get_grid_type_as_beats (success, _region->position());
+ if (!success) {
+ /* XXX cannot get grid type as beats ... should always be possible ... FIX ME */
+ cerr << "Grid type not available as beats - TO BE FIXED\n";
+ return;
+ }
+ }
+ }
if (shorter) {
delta = -delta;