diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 67e93ccb1b..8b71989f67 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -693,3 +693,9 @@ MidiRegionView::select_self_uniquely () { _editing_context.set_selected_midi_region_view (*this); } + +void +MidiRegionView::set_visibility_note_range (MidiViewBackground::VisibleNoteRange vnr, bool from_selection) +{ + dynamic_cast(&trackview)->set_visibility_note_range (vnr, from_selection); +} diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index 0cb09831a6..c238d5c127 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -131,6 +131,8 @@ public: void select_self_uniquely (); void begin_drag_edit (std::string const & why); + void set_visibility_note_range (MidiViewBackground::VisibleNoteRange, bool); + protected: void reset_width_dependent_items (double pixel_width); void parameter_changed (std::string const & p); diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 46ddb81422..ea25f61e63 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -746,12 +746,12 @@ MidiTimeAxisView::append_extra_display_menu_items () range_items.push_back ( MenuElem (_("Show Full Range"), - sigc::bind (sigc::mem_fun(*this, &MidiTimeAxisView::set_note_range), + sigc::bind (sigc::mem_fun(*this, &MidiTimeAxisView::set_visibility_note_range), MidiStreamView::FullRange, true))); range_items.push_back ( MenuElem (_("Fit Contents"), - sigc::bind (sigc::mem_fun(*this, &MidiTimeAxisView::set_note_range), + sigc::bind (sigc::mem_fun(*this, &MidiTimeAxisView::set_visibility_note_range), MidiStreamView::ContentsRange, true))); items.push_back (MenuElem (_("Note Range"), *range_menu)); @@ -1326,11 +1326,11 @@ MidiTimeAxisView::set_color_mode (ColorMode mode, bool force, bool redisplay, bo } void -MidiTimeAxisView::set_note_range (MidiStreamView::VisibleNoteRange range, bool apply_to_selection) +MidiTimeAxisView::set_visibility_note_range (MidiStreamView::VisibleNoteRange range, bool apply_to_selection) { if (apply_to_selection) { _editor.get_selection().tracks.foreach_midi_time_axis ( - boost::bind (&MidiTimeAxisView::set_note_range, _1, range, false)); + boost::bind (&MidiTimeAxisView::set_visibility_note_range, _1, range, false)); } else { if (!_ignore_signals) { midi_view()->set_note_visibility_range_style (range); diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index 2078e2e7d0..4b53cff4e7 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -113,7 +113,7 @@ public: void get_per_region_note_selection (std::list > > > >&); void use_midnam_info (); - void set_note_range (MidiStreamView::VisibleNoteRange range, bool apply_to_selection = false); + void set_visibility_note_range (MidiStreamView::VisibleNoteRange range, bool apply_to_selection = false); protected: void start_step_editing (); diff --git a/gtk2_ardour/midi_view.h b/gtk2_ardour/midi_view.h index 05dca80059..ec19c6bbb3 100644 --- a/gtk2_ardour/midi_view.h +++ b/gtk2_ardour/midi_view.h @@ -300,6 +300,7 @@ class MidiView : public virtual sigc::trackable void show_list_editor (); void set_note_range (uint8_t low, uint8_t high); + virtual void set_visibility_note_range (MidiViewBackground::VisibleNoteRange, bool) {}; typedef std::set Selection; Selection const & selection () const { diff --git a/gtk2_ardour/piano_roll_header.cc b/gtk2_ardour/piano_roll_header.cc index d23b974b26..d58f95e099 100644 --- a/gtk2_ardour/piano_roll_header.cc +++ b/gtk2_ardour/piano_roll_header.cc @@ -652,7 +652,7 @@ PianoRollHeader::on_button_press_event (GdkEventButton* ev) if (ev->type == GDK_2BUTTON_PRESS) { MidiTimeAxisView* mtv = dynamic_cast(&_view.trackview()); if (mtv) { - mtv->set_note_range (MidiStreamView::ContentsRange, false); + mtv->set_visibility_note_range (MidiStreamView::ContentsRange, false); } return true; } diff --git a/gtk2_ardour/prh.cc b/gtk2_ardour/prh.cc index 25e9208858..c22c05df2b 100644 --- a/gtk2_ardour/prh.cc +++ b/gtk2_ardour/prh.cc @@ -253,13 +253,12 @@ PianoRollHeader::get_path (int note, double x[], double y[]) const { double y_pos = floor(_view.midi_context().note_to_y(note)); double note_height; - _raw_note_height = floor(_view.midi_context().note_to_y(note - 1)) - y_pos; double width = get().width() - 1.0f; if (note == 0) { note_height = floor(_view.midi_context().contents_height()) - y_pos; } else { - note_height = _raw_note_height <= 3 ? _raw_note_height : _raw_note_height - 1.f; + note_height = _view.midi_context().note_height() <= 3 ? _view.midi_context().note_height() : _view.midi_context().note_height() - 1.f; } x[0] = _scroomer_size; @@ -647,7 +646,7 @@ PianoRollHeader::motion_handler (GdkEventMotion* ev) case TOP: real_val_at_pointer = real_val_at_pointer <= _saved_top_val? _adj.get_value() + _adj.get_page_size() : real_val_at_pointer; real_val_at_pointer = min(127.0, real_val_at_pointer); - if (_note_height >= UIConfiguration::instance().get_max_note_height()){ + if (_view.midi_context().note_height() >= UIConfiguration::instance().get_max_note_height()){ _saved_top_val = min(_adj.get_value() + _adj.get_page_size (), 127.0); } else { _saved_top_val = 0.0; @@ -659,7 +658,7 @@ PianoRollHeader::motion_handler (GdkEventMotion* ev) case BOTTOM: real_val_at_pointer = max(0.0, real_val_at_pointer); real_val_at_pointer = real_val_at_pointer >= _saved_bottom_val? _adj.get_value() : real_val_at_pointer; - if (_note_height >= UIConfiguration::instance().get_max_note_height()){ + if (_view.midi_context().note_height() >= UIConfiguration::instance().get_max_note_height()){ _saved_bottom_val = _adj.get_value(); } else { _saved_bottom_val = 127.0; @@ -719,7 +718,7 @@ PianoRollHeader::button_press_handler (GdkEventButton* ev) if (ev->button == 1 && ev->x <= _scroomer_size){ if (ev->type == GDK_2BUTTON_PRESS) { - // _view.set_note_range (MidiStreamView::ContentsRange, false); + _view.set_note_range (MidiStreamView::ContentsRange, false); return true; } @@ -858,7 +857,6 @@ PianoRollHeader::leave_handler (GdkEventCrossing*) void PianoRollHeader::note_range_changed () { - _note_height = floor (_view.midi_context().note_height ()) + 0.5f; redraw (); } diff --git a/gtk2_ardour/prh.h b/gtk2_ardour/prh.h index f0aef0b12f..7724296a0a 100644 --- a/gtk2_ardour/prh.h +++ b/gtk2_ardour/prh.h @@ -122,7 +122,6 @@ private: double _old_y; double _fract; double _fract_top; - mutable double _raw_note_height; double _min_page_size; enum scr_pos {TOP, BOTTOM, MOVE, NONE}; scr_pos _scroomer_state; @@ -132,9 +131,6 @@ private: mutable bool _mini_map_display; bool entered; - double _note_height; - double _old_av_note_height; - bool show_scroomer () const; ArdourCanvas::Rect _alloc;