diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-11 19:42:42 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-11 19:42:42 +0000 |
commit | 8bdf5cf1d0caa0c6e96c43d19dae756094eb4e2b (patch) | |
tree | c79bc7aa580a4f7e2ba0d66582d8a07c8cda6ef7 /gtk2_ardour | |
parent | afd5b2002a796a85b7e5c1644581aaaa41de0fb8 (diff) |
fix up initial step edit pos when operating on an existing region
git-svn-id: svn://localhost/ardour2/branches/3.0@7600 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 32 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.h | 1 |
3 files changed, 22 insertions, 15 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 32ef8b184f..7438e3e862 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -2991,8 +2991,8 @@ MidiRegionView::show_step_edit_cursor (Evoral::MusicalTime pos) _step_edit_cursor = new ArdourCanvas::SimpleRect (*group); _step_edit_cursor->property_y1() = 0; _step_edit_cursor->property_y2() = midi_stream_view()->contents_height(); - _step_edit_cursor->property_fill_color_rgba() = RGBA_TO_UINT (45,45,45,90); - _step_edit_cursor->property_outline_color_rgba() = RGBA_TO_UINT (255,255,255,90); + _step_edit_cursor->property_fill_color_rgba() = RGBA_TO_UINT (45,0,0,90); + _step_edit_cursor->property_outline_color_rgba() = RGBA_TO_UINT (85,0,0,90); } move_step_edit_cursor (pos); diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 1ddf309cce..79e53a1faf 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -895,7 +895,6 @@ void MidiTimeAxisView::start_step_editing () { step_edit_insert_position = _editor.get_preferred_edit_position (); - step_edit_beat_pos = -1.0; _step_edit_triplet_countdown = 0; _step_edit_within_chord = 0; _step_edit_chord_duration = 0.0; @@ -912,15 +911,23 @@ MidiTimeAxisView::start_step_editing () step_edit_region_view = dynamic_cast<MidiRegionView*>(rv); } + assert (step_edit_region); + assert (step_edit_region_view); + if (step_editor == 0) { step_editor = new StepEntry (*this); step_editor->signal_delete_event().connect (sigc::mem_fun (*this, &MidiTimeAxisView::step_editor_hidden)); + step_editor->signal_hide().connect (sigc::mem_fun (*this, &MidiTimeAxisView::step_editor_hide)); } - if (step_edit_region_view) { - step_edit_region_view->show_step_edit_cursor (0.0); - step_edit_region_view->set_step_edit_cursor_width (step_editor->note_length()); - } + framecnt_t frames_from_start = _editor.get_preferred_edit_position() - step_edit_region->position(); + + assert (frames_from_start >= 0); + + step_edit_beat_pos = step_edit_region_view->frames_to_beats (frames_from_start); + + step_edit_region_view->show_step_edit_cursor (step_edit_beat_pos); + step_edit_region_view->set_step_edit_cursor_width (step_editor->note_length()); step_editor->set_position (WIN_POS_MOUSE); step_editor->present (); @@ -929,9 +936,15 @@ MidiTimeAxisView::start_step_editing () bool MidiTimeAxisView::step_editor_hidden (GdkEventAny*) { + step_editor_hide (); + return true; +} + +void +MidiTimeAxisView::step_editor_hide () +{ /* everything else will follow the change in the model */ midi_track()->set_step_editing (false); - return true; } void @@ -992,13 +1005,6 @@ int MidiTimeAxisView::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::MusicalTime beat_duration) { if (step_edit_region && step_edit_region_view) { - if (step_edit_beat_pos < 0.0) { - framecnt_t frames_from_start = _editor.get_preferred_edit_position() - step_edit_region->position(); - if (frames_from_start < 0) { - return 1; - } - step_edit_beat_pos = step_edit_region_view->frames_to_beats (frames_from_start); - } if (beat_duration == 0.0) { bool success; diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index bdd52d5265..cbca25bd0e 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -182,6 +182,7 @@ class MidiTimeAxisView : public RouteTimeAxisView StepEntry* step_editor; bool step_editor_hidden (GdkEventAny*); + void step_editor_hide (); }; #endif /* __ardour_midi_time_axis_h__ */ |