void set_internal_edit (bool yn);
bool toggle_internal_editing_from_double_click (GdkEvent*);
- void _ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
void add_to_idle_resize (TimeAxisView*, int32_t);
framecnt_t get_current_zoom () const { return samples_per_pixel; }
void cycle_zoom_focus ();
void temporal_zoom_step (bool coarser);
+ void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
void tav_zoom_step (bool coarser);
void tav_zoom_smooth (bool coarser, bool force_all);
}
void
-Editor::_ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_top)
+Editor::ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_top)
{
if (track.hidden()) {
return;
double const track_max_y = track.y_position () + track.effective_height ();
if (!at_top &&
- (track_min_y > current_view_min_y &&
- track_max_y <= current_view_max_y)) {
+ (track_min_y >= current_view_min_y &&
+ track_max_y < current_view_max_y)) {
+ /* already visible, and caller did not ask to place it at the
+ * top of the track canvas
+ */
return;
}
double new_value;
- if (track_min_y < current_view_min_y) {
- // Track is above the current view
+ if (at_top) {
new_value = track_min_y;
} else {
- // Track is below the current view
- new_value = track.y_position () + track.effective_height() - vertical_adjustment.get_page_size();
+ if (track_min_y < current_view_min_y) {
+ // Track is above the current view
+ new_value = track_min_y;
+ } else if (track_max_y > current_view_max_y) {
+ // Track is below the current view
+ new_value = track.y_position () + track.effective_height() - vertical_adjustment.get_page_size();
+ } else {
+ new_value = track_min_y;
+ }
}
vertical_adjustment.set_value(new_value);
bool
Editor::scroll_down_one_track ()
{
- TrackViewList::reverse_iterator next = track_views.rend();
+ TrackViewList::reverse_iterator next = track_views.rbegin();
std::pair<TimeAxisView*,double> res;
- const double bottom_of_trackviews = vertical_adjustment.get_value() + vertical_adjustment.get_page_size() - 1;
+ const double top_of_trackviews = vertical_adjustment.get_value();
for (TrackViewList::reverse_iterator t = track_views.rbegin(); t != track_views.rend(); ++t) {
if ((*t)->hidden()) {
continue;
}
-
- /* If this is the bottom visible trackview, we want to display
- the next one.
+
+ next = t;
+ if (next != track_views.rbegin()) {
+ --next; // moves "next" towards the lower/later tracks since it is a reverse iterator
+ }
+
+ /* If this is the upper-most visible trackview, we want to display
+ the one above it (next)
*/
- res = (*t)->covers_y_position (bottom_of_trackviews);
+ res = (*t)->covers_y_position (top_of_trackviews);
if (res.first) {
break;
}
-
- ++next; // moves "next" towards the "front" since it is a reverse iterator
}
/* move to the track below the first one that covers the */
- if (next != track_views.rend()) {
- ensure_time_axis_view_is_visible (**next);
+ if (next != track_views.rbegin()) {
+ ensure_time_axis_view_is_visible (**next, true);
return true;
}
bool
Editor::scroll_up_one_track ()
{
- double vertical_pos = vertical_adjustment.get_value ();
-
TrackViewList::iterator prev = track_views.end();
std::pair<TimeAxisView*,double> res;
-
+ double top_of_trackviews = vertical_adjustment.get_value ();
+
for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) {
if ((*t)->hidden()) {
}
/* find the trackview at the top of the trackview group */
- res = (*t)->covers_y_position (vertical_pos);
+ res = (*t)->covers_y_position (top_of_trackviews);
if (res.first) {
- cerr << res.first->name() << " covers the top\n";
break;
}
}
if (prev != track_views.end()) {
- ensure_time_axis_view_is_visible (**prev);
+ ensure_time_axis_view_is_visible (**prev, true);
return true;
}
selection->set(current);
- ensure_time_axis_view_is_visible (*current);
+ ensure_time_axis_view_is_visible (*current, false);
}
void
selection->set (current);
- ensure_time_axis_view_is_visible (*current);
+ ensure_time_axis_view_is_visible (*current, false);
}
void
virtual framecnt_t current_page_samples() const = 0;
virtual double visible_canvas_height () const = 0;
virtual void temporal_zoom_step (bool coarser) = 0;
- /* The virtual version, without a default argument, is protected below.
- */
- void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top = false) {
- _ensure_time_axis_view_is_visible (tav, at_top);
- }
+ virtual void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top = false) = 0;
virtual void override_visible_track_count () = 0;
virtual void scroll_tracks_down_line () = 0;
virtual void scroll_tracks_up_line () = 0;
PBD::Signal0<void> MouseModeChanged;
protected:
- /* This _ variant of ensure_time_axis_view_is_visible exists because
- C++ doesn't really like default values for virtual methods. So the
- public version is non-virtual, with a default value; the virtual
- (and protected) method here does not have a default value.
- */
- virtual void _ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top) = 0;
-
friend class DisplaySuspender;
virtual void suspend_route_redisplay () = 0;
virtual void resume_route_redisplay () = 0;
}
if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
- _editor.ensure_time_axis_view_is_visible (**i);
+ _editor.ensure_time_axis_view_is_visible (**i, false);
(*i)->begin_name_edit ();
}
}
if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
- _editor.ensure_time_axis_view_is_visible (**i);
+ _editor.ensure_time_axis_view_is_visible (**i, false);
(*i)->begin_name_edit ();
}
}