add API to select TAV height mode.
authorRobin Gareus <robin@gareus.org>
Thu, 19 Mar 2015 20:47:34 +0000 (21:47 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 19 Mar 2015 20:47:34 +0000 (21:47 +0100)
preparation for further Summary and Number of visible
track count fixes.

* “Only Self”: don’t resize child-views (old default)
* “Total Height”: distribute height equally among
   all visible child [automation] lanes
* “Height per Lane”: given height should be applied
   to all sub-views.

gtk2_ardour/automation_time_axis.cc
gtk2_ardour/automation_time_axis.h
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/midi_time_axis.h
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h

index a4b7a7b00523b45b2865c3dc3b49eb77a42b418b..5798344b8a63416a692f8bea103d9e02c0eff337 100644 (file)
@@ -454,13 +454,13 @@ AutomationTimeAxisView::clear_clicked ()
 }
 
 void
-AutomationTimeAxisView::set_height (uint32_t h)
+AutomationTimeAxisView::set_height (uint32_t h, TrackHeightMode m)
 {
        bool const changed = (height != (uint32_t) h) || first_call_to_set_height;
        uint32_t const normal = preset_height (HeightNormal);
        bool const changed_between_small_and_normal = ( (height < normal && h >= normal) || (height >= normal || h < normal) );
 
-       TimeAxisView::set_height (h);
+       TimeAxisView::set_height (h, m);
 
        _base_rect->set_y1 (h);
 
index 53928724d85fbca16a881c3bf25de13159e2a521..aef1300405c771c7aa9457d1fb9562848dd5087f 100644 (file)
@@ -69,7 +69,7 @@ class AutomationTimeAxisView : public TimeAxisView {
 
        ~AutomationTimeAxisView();
 
-       virtual void set_height (uint32_t);
+       virtual void set_height (uint32_t, TrackHeightMode m = OnlySelf);
        void set_samples_per_pixel (double);
        std::string name() const { return _name; }
 
index 304593227cc6de9aa5ff23cebaab3cbdeab7828f..cf1b8a1b3b656f6b8b2b8076bea0fe84938ffdfb 100644 (file)
@@ -467,7 +467,7 @@ MidiTimeAxisView::midi_view()
 }
 
 void
-MidiTimeAxisView::set_height (uint32_t h)
+MidiTimeAxisView::set_height (uint32_t h, TrackHeightMode m)
 {
        if (h >= MIDI_CONTROLS_BOX_MIN_HEIGHT) {
                _midi_controls_box.show ();
@@ -496,7 +496,7 @@ MidiTimeAxisView::set_height (uint32_t h)
           which needs to know if we have just shown or hidden a scroomer /
           piano roll.
        */
-       RouteTimeAxisView::set_height (h);
+       RouteTimeAxisView::set_height (h, m);
 }
 
 void
index ffdeddc7c7ec3064e5def826c15f7cb21d964524..f9b81470d086cc0d1ec6899e04ab04c63e0b3f29 100644 (file)
@@ -78,7 +78,7 @@ public:
 
        MidiStreamView* midi_view();
 
-       void set_height (uint32_t);
+       void set_height (uint32_t, TrackHeightMode m = OnlySelf);
 
        boost::shared_ptr<ARDOUR::MidiRegion> add_region (ARDOUR::framepos_t, ARDOUR::framecnt_t, bool);
 
index 20c98765190ddfaadb49965cbe3ab161c8c8f195..502e24d8a064b275a7e5f8d1a61138479c51e5ce 100644 (file)
@@ -961,7 +961,7 @@ RouteTimeAxisView::show_selection (TimeSelection& ts)
 }
 
 void
-RouteTimeAxisView::set_height (uint32_t h)
+RouteTimeAxisView::set_height (uint32_t h, TrackHeightMode m)
 {
        int gmlen = h - 9;
        bool height_changed = (height == 0) || (h != height);
@@ -972,7 +972,7 @@ RouteTimeAxisView::set_height (uint32_t h)
        }
        gm.get_level_meter().setup_meters (gmlen, meter_width);
 
-       TimeAxisView::set_height (h);
+       TimeAxisView::set_height (h, m);
 
        if (_view) {
                _view->set_height ((double) current_height());
index 3aedc4d336ed97b020c6b7bfef0e5a6b89805434..ea278e417554cd42101f298c7d9df1bef46234dc 100644 (file)
@@ -84,7 +84,7 @@ public:
        void set_button_names ();
 
        void set_samples_per_pixel (double);
-       void set_height (uint32_t h);
+       void set_height (uint32_t h, TrackHeightMode m = OnlySelf);
        void show_timestretch (framepos_t start, framepos_t end, int layers, int layer);
        void hide_timestretch ();
        void selection_click (GdkEventButton*);
index a117bb64c1060424be547f2426edfb33fcf4dbb2..cb03252d7f8b3c6f1d58154ad8afcfbf6c9f016c 100644 (file)
@@ -568,8 +568,16 @@ TimeAxisView::set_height_enum (Height h, bool apply_to_selection)
 }
 
 void
-TimeAxisView::set_height (uint32_t h)
+TimeAxisView::set_height (uint32_t h, TrackHeightMode m)
 {
+       uint32_t lanes = 0;
+       if (m == TotalHeight) {
+               for (Children::iterator i = children.begin(); i != children.end(); ++i) {
+                       if ( !(*i)->hidden()) ++lanes;
+               }
+       }
+       h /= (lanes + 1);
+
        if (h < preset_height (HeightSmall)) {
                h = preset_height (HeightSmall);
        }
@@ -590,6 +598,12 @@ TimeAxisView::set_height (uint32_t h)
                show_selection (_editor.get_selection().time);
        }
 
+       if (m != OnlySelf) {
+               for (Children::iterator i = children.begin(); i != children.end(); ++i) {
+                       (*i)->set_height(h, OnlySelf);
+               }
+       }
+
        _editor.override_visible_track_count ();
 }
 
index 6827251472b8fe9ee09f37a8b348b27eba10eb4b..baeeb2a92abed5d18558bf72cc7d63381cacb1ce 100644 (file)
@@ -142,7 +142,13 @@ class TimeAxisView : public virtual AxisView
        virtual void entered () {}
        virtual void exited () {}
 
-       virtual void set_height (uint32_t h);
+       enum TrackHeightMode {
+               OnlySelf,
+               TotalHeight,
+               HeightPerLane
+       };
+
+       virtual void set_height (uint32_t h, TrackHeightMode m = OnlySelf);
        void set_height_enum (Height, bool apply_to_selection = false);
        void reset_height();