From 4a174039ae3282882dd0b06f7f7689bed97e211a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 13 Jun 2012 20:37:34 +0000 Subject: Shrink the midi scroomer to match the keyboard in stacked mode. git-svn-id: svn://localhost/ardour2/branches/3.0@12710 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_scroomer.cc | 8 -------- gtk2_ardour/midi_scroomer.h | 1 - gtk2_ardour/midi_time_axis.cc | 16 ++++++++++++++-- gtk2_ardour/midi_time_axis.h | 1 + gtk2_ardour/streamview.cc | 2 ++ gtk2_ardour/streamview.h | 2 ++ 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/gtk2_ardour/midi_scroomer.cc b/gtk2_ardour/midi_scroomer.cc index cccc03c507..c3295c8f73 100644 --- a/gtk2_ardour/midi_scroomer.cc +++ b/gtk2_ardour/midi_scroomer.cc @@ -165,12 +165,4 @@ void MidiScroomer::on_size_request(Gtk::Requisition* r) { r->width = 12; - r->height = 100; } - -void -MidiScroomer::on_size_allocate(Gtk::Allocation& a) -{ - Scroomer::on_size_allocate(a); -} - diff --git a/gtk2_ardour/midi_scroomer.h b/gtk2_ardour/midi_scroomer.h index 5f758c727d..b27c66dbe9 100644 --- a/gtk2_ardour/midi_scroomer.h +++ b/gtk2_ardour/midi_scroomer.h @@ -30,7 +30,6 @@ class MidiScroomer : public Gtkmm2ext::Scroomer { bool on_expose_event(GdkEventExpose*); void on_size_request(Gtk::Requisition*); - void on_size_allocate(Gtk::Allocation&); void get_colors(double color[], Component comp); }; diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 80a5a50c0c..f0a9a8b2d4 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -125,7 +125,7 @@ MidiTimeAxisView::set_route (boost::shared_ptr rt) _route = rt; _view = new MidiStreamView (*this); - + if (is_track ()) { _piano_roll_header = new PianoRollHeader(*midi_view()); _range_scroomer = new MidiScroomer(midi_view()->note_range_adjustment); @@ -145,6 +145,7 @@ MidiTimeAxisView::set_route (boost::shared_ptr rt) midi_view()->apply_note_range (atoi (gui_property ("note-range-min").c_str()), atoi (gui_property ("note-range-max").c_str()), true); } midi_view()->NoteRangeChanged.connect (sigc::mem_fun (*this, &MidiTimeAxisView::note_range_changed)); + _view->ContentsHeightChanged.connect (sigc::mem_fun (*this, &MidiTimeAxisView::contents_height_changed)); ignore_toggle = false; @@ -171,7 +172,13 @@ MidiTimeAxisView::set_route (boost::shared_ptr rt) _range_scroomer->DragStarting.connect (sigc::mem_fun (*midi_view(), &MidiStreamView::suspend_updates)); _range_scroomer->DragFinishing.connect (sigc::mem_fun (*midi_view(), &MidiStreamView::resume_updates)); - controls_hbox.pack_start(*_range_scroomer); + /* Put the scroomer in a VBox with a padding label so that it can be reduced in height + for stacked-view tracks. + */ + VBox* b = manage (new VBox); + b->pack_start (*_range_scroomer, false, false); + b->pack_start (*manage (new Label ("")), true, true); + controls_hbox.pack_start(*b); controls_hbox.pack_start(*_piano_roll_header); controls_ebox.set_name ("MidiTrackControlsBaseUnselected"); @@ -1227,3 +1234,8 @@ MidiTimeAxisView::note_range_changed () set_gui_property ("note-range-max", (int) midi_view()->highest_note ()); } +void +MidiTimeAxisView::contents_height_changed () +{ + _range_scroomer->set_size_request (-1, _view->child_height ()); +} diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index 356a2474db..4da89df109 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -118,6 +118,7 @@ class MidiTimeAxisView : public RouteTimeAxisView void route_active_changed (); void note_range_changed (); + void contents_height_changed (); bool _ignore_signals; MidiScroomer* _range_scroomer; diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index f72b464d80..19f6ee65bb 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -613,6 +613,8 @@ StreamView::update_contents_height () break; } } + + ContentsHeightChanged (); /* EMIT SIGNAL */ } void diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index 0d15a5d7d7..49001f57f6 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -122,6 +122,8 @@ public: sigc::signal RegionViewAdded; sigc::signal RegionViewRemoved; + /** Emitted when the height of regions has changed */ + sigc::signal ContentsHeightChanged; protected: StreamView (RouteTimeAxisView&, ArdourCanvas::Group* background_group = 0, ArdourCanvas::Group* canvas_group = 0); -- cgit v1.2.3