summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-03-19 21:47:34 +0100
committerRobin Gareus <robin@gareus.org>2015-03-19 21:47:34 +0100
commitf1ce87a699c9cca17197b4f33bec5da163810d4f (patch)
treeb050b8ceeb6a2b23494da82cfb3f9d87cac9512f
parent6874bca886ad9778a7bedd78a25d56f0bd277cf3 (diff)
add API to select TAV height mode.
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.
-rw-r--r--gtk2_ardour/automation_time_axis.cc4
-rw-r--r--gtk2_ardour/automation_time_axis.h2
-rw-r--r--gtk2_ardour/midi_time_axis.cc4
-rw-r--r--gtk2_ardour/midi_time_axis.h2
-rw-r--r--gtk2_ardour/route_time_axis.cc4
-rw-r--r--gtk2_ardour/route_time_axis.h2
-rw-r--r--gtk2_ardour/time_axis_view.cc16
-rw-r--r--gtk2_ardour/time_axis_view.h8
8 files changed, 31 insertions, 11 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index a4b7a7b005..5798344b8a 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -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);
diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h
index 53928724d8..aef1300405 100644
--- a/gtk2_ardour/automation_time_axis.h
+++ b/gtk2_ardour/automation_time_axis.h
@@ -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; }
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 304593227c..cf1b8a1b3b 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -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
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index ffdeddc7c7..f9b81470d0 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -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);
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 20c9876519..502e24d8a0 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -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());
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 3aedc4d336..ea278e4175 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -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*);
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index a117bb64c1..cb03252d7f 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -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 ();
}
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index 6827251472..baeeb2a92a 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -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();