extend step-edited region correctly; scroll to keep newly step-edited notes in view

git-svn-id: svn://localhost/ardour2/branches/3.0@7538 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-08-04 17:57:41 +00:00
parent 46eaff772d
commit 8588225b31
3 changed files with 19 additions and 17 deletions

View File

@ -1471,7 +1471,7 @@ MidiRegionView::step_add_note (uint8_t channel, uint8_t number, uint8_t velocity
nframes64_t region_end = _region->position() + _region->length() - 1; nframes64_t region_end = _region->position() + _region->length() - 1;
if (end_frame > region_end) { if (end_frame > region_end) {
_region->set_length (end_frame, this); _region->set_length (end_frame - _region->position(), this);
} }
start_diff_command (_("step add")); start_diff_command (_("step add"));

View File

@ -968,14 +968,6 @@ MidiTimeAxisView::check_step_edit ()
int int
MidiTimeAxisView::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::MusicalTime beat_duration) MidiTimeAxisView::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::MusicalTime beat_duration)
{ {
MidiStreamView* msv = midi_view();
/* make sure its visible on the vertical axis */
if (pitch < msv->lowest_note() || pitch > msv->highest_note()) {
msv->update_note_range (pitch);
msv->set_note_range (MidiStreamView::ContentsRange);
}
if (step_edit_region == 0) { if (step_edit_region == 0) {
@ -1002,6 +994,24 @@ MidiTimeAxisView::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocit
} }
} }
MidiStreamView* msv = midi_view();
/* make sure its visible on the vertical axis */
if (pitch < msv->lowest_note() || pitch > msv->highest_note()) {
msv->update_note_range (pitch);
msv->set_note_range (MidiStreamView::ContentsRange);
}
/* make sure its visible on the horizontal axis */
nframes64_t fpos = step_edit_region->position() +
step_edit_region_view->beats_to_frames (step_edit_beat_pos + beat_duration);
if (fpos >= (_editor.leftmost_position() + _editor.current_page_frames())) {
_editor.reset_x_origin (fpos - (_editor.current_page_frames()/4));
}
step_edit_region_view->step_add_note (channel, pitch, velocity, step_edit_beat_pos, beat_duration); step_edit_region_view->step_add_note (channel, pitch, velocity, step_edit_beat_pos, beat_duration);
if (_step_edit_triplet_countdown > 0) { if (_step_edit_triplet_countdown > 0) {

View File

@ -250,10 +250,6 @@ StepEntry::~StepEntry()
bool bool
StepEntry::on_key_press_event (GdkEventKey* ev) StepEntry::on_key_press_event (GdkEventKey* ev)
{ {
std::cerr << "Propagate key press, focus widget = "
<< gtk_window_get_focus (GTK_WINDOW(gobj()))
<< " _piano = " << _piano << std::endl;
if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) { if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
return gtk_window_activate_key (GTK_WINDOW(gobj()), ev); return gtk_window_activate_key (GTK_WINDOW(gobj()), ev);
} }
@ -263,10 +259,6 @@ StepEntry::on_key_press_event (GdkEventKey* ev)
bool bool
StepEntry::on_key_release_event (GdkEventKey* ev) StepEntry::on_key_release_event (GdkEventKey* ev)
{ {
std::cerr << "Propagate key release, focus widget = "
<< gtk_window_get_focus (GTK_WINDOW(gobj()))
<< " _piano = " << _piano << std::endl;
if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) { if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
return gtk_window_activate_key (GTK_WINDOW(gobj()), ev); return gtk_window_activate_key (GTK_WINDOW(gobj()), ev);
} }