hide "turn down volume" label for midi-latency measurement
[ardour.git] / gtk2_ardour / editor_ops.cc
index e6b4fee43ef733052142ba050813a517a41d6489..0151df872f701a72a61b7a52d172a5d918486542 100644 (file)
@@ -70,7 +70,6 @@
 #include "editor_drag.h"
 #include "editor_regions.h"
 #include "editor_routes.h"
-#include "gtk-custom-hruler.h"
 #include "gui_thread.h"
 #include "insert_time_dialog.h"
 #include "interthread_progress_window.h"
@@ -1333,8 +1332,6 @@ Editor::scroll_tracks_up_line ()
 bool
 Editor::scroll_down_one_track ()
 {
-       double vertical_pos = vertical_adjustment.get_value () + vertical_adjustment.get_page_size() - 1.0; 
-
        TrackViewList::reverse_iterator next = track_views.rend();
        std::pair<TimeAxisView*,double> res;
 
@@ -1343,7 +1340,8 @@ Editor::scroll_down_one_track ()
                        continue;
                }
                
-               res = (*t)->covers_y_position (vertical_pos);
+               /* find the trackview at the bottom of the trackview group */
+               res = (*t)->covers_y_position (_visible_canvas_height);
 
                if (res.first) {
                        break;
@@ -1365,7 +1363,7 @@ Editor::scroll_down_one_track ()
 bool
 Editor::scroll_up_one_track ()
 {
-       double vertical_pos = vertical_adjustment.get_value ();
+       // double vertical_pos = vertical_adjustment.get_value ();
 
        TrackViewList::iterator prev = track_views.end();
        std::pair<TimeAxisView*,double> res;
@@ -1376,7 +1374,8 @@ Editor::scroll_up_one_track ()
                        continue;
                }
 
-               res = (*t)->covers_y_position(vertical_pos);
+               /* find the trackview at the top of the trackview group */
+               res = (*t)->covers_y_position (0);
                
                if (res.first) {
                        break;
@@ -1458,8 +1457,23 @@ Editor::clamp_samples_per_pixel (framecnt_t& fpp) const
                clamped = true;
        }
 
-       if (max_framepos / fpp < 800) {
-               fpp = max_framepos / 800;
+       framecnt_t sr;
+
+       if (_session) {
+               sr = _session->frame_rate ();
+       } else {
+               sr = 48000;
+       }
+
+       const framecnt_t three_days = 3 * 24 * 60 * 60 * sr;
+       const framecnt_t lots_of_pixels = 4000;
+
+       /* if the zoom level is greater than what you'd get trying to display 3
+        * days of audio on a really big screen, scale it down.
+        */
+
+       if (fpp * lots_of_pixels > three_days) {
+               fpp = three_days / _track_canvas->width();
                clamped = true;
        }
 
@@ -6860,7 +6874,13 @@ Editor::fit_tracks (TrackViewList & tracks)
                ++visible_tracks;
        }
 
-       uint32_t h = (uint32_t) floor ((_visible_canvas_height - child_heights) / visible_tracks);
+       /* compute the per-track height from:
+
+          total canvas visible height - 
+                 height that will be taken by visible children of selected
+                 tracks - height of the ruler/hscroll area 
+       */
+       uint32_t h = (uint32_t) floor ((_visible_canvas_height - (child_heights + _trackview_group->canvas_origin().y)) / visible_tracks);
        double first_y_pos = DBL_MAX;
 
        if (h < TimeAxisView::preset_height (HeightSmall)) {
@@ -6885,9 +6905,7 @@ Editor::fit_tracks (TrackViewList & tracks)
 
        /* operate on all tracks, hide unselected ones that are in the middle of selected ones */
 
-       bool prev_was_selected = false;
-       bool is_selected = tracks.contains (all.front());
-       bool next_is_selected;
+       bool within_selected = false;
 
        for (TrackViewList::iterator t = all.begin(); t != all.end(); ++t) {
 
@@ -6895,26 +6913,16 @@ Editor::fit_tracks (TrackViewList & tracks)
 
                next = t;
                ++next;
-
-               if (next != all.end()) {
-                       next_is_selected = tracks.contains (*next);
-               } else {
-                       next_is_selected = false;
-               }
-
+               
                if ((*t)->marked_for_display ()) {
-                       if (is_selected) {
+                       if (tracks.contains (*t)) { 
                                (*t)->set_height (h);
                                first_y_pos = std::min ((*t)->y_position (), first_y_pos);
-                       } else {
-                               if (prev_was_selected && next_is_selected) {
-                                       hide_track_in_display (*t);
-                               }
+                               within_selected = true;
+                       } else if (within_selected) {
+                               hide_track_in_display (*t);
                        }
                }
-
-               prev_was_selected = is_selected;
-               is_selected = next_is_selected;
        }
 
        /*