From a6392f5d14adca9bdcedf6217195cf6d4824b6d9 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 27 Nov 2011 00:52:10 +0100 Subject: [PATCH] review and annotate design aspects regarding zoom handling --- src/gui/panels/timeline-panel.cpp | 1 - src/gui/widgets/timeline-widget.cpp | 3 ++- src/gui/widgets/timeline/timeline-body.cpp | 3 ++- src/gui/widgets/timeline/timeline-ruler.cpp | 2 ++ src/gui/widgets/timeline/timeline-view-window.cpp | 12 ++++-------- src/gui/widgets/timeline/timeline-zoom-scale.cpp | 1 + 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gui/panels/timeline-panel.cpp b/src/gui/panels/timeline-panel.cpp index 0366504c6..827a2bee9 100644 --- a/src/gui/panels/timeline-panel.cpp +++ b/src/gui/panels/timeline-panel.cpp @@ -144,7 +144,6 @@ TimelinePanel::TimelinePanel (workspace::PanelManager &panel_manager, update_tool_buttons(); update_zoom_buttons(); show_time (Time::ZERO); - std::cout << timelineWidget->get_state()->get_view_window().get_time_scale() << "\n"; } const char* diff --git a/src/gui/widgets/timeline-widget.cpp b/src/gui/widgets/timeline-widget.cpp index b971477c6..81d93e5ba 100644 --- a/src/gui/widgets/timeline-widget.cpp +++ b/src/gui/widgets/timeline-widget.cpp @@ -415,12 +415,13 @@ TimelineWidget::update_scroll() if(state) { + ///////////////////////////////////////////////TICKET #861 shoudln't that be performed by TimelineViewWindow, instead of manipulating values from the outside? timeline::TimelineViewWindow &window = state->get_view_window(); //----- Horizontal Scroll ------// // TEST CODE - horizontalAdjustment.set_upper(1000 * GAVL_TIME_SCALE / 200); + horizontalAdjustment.set_upper( 1000 * GAVL_TIME_SCALE / 200); horizontalAdjustment.set_lower(-1000 * GAVL_TIME_SCALE / 200); // Set the page size diff --git a/src/gui/widgets/timeline/timeline-body.cpp b/src/gui/widgets/timeline/timeline-body.cpp index 650feeb6b..1b580c262 100644 --- a/src/gui/widgets/timeline/timeline-body.cpp +++ b/src/gui/widgets/timeline/timeline-body.cpp @@ -267,7 +267,8 @@ TimelineBody::on_motion_notify_event(GdkEventMotion *event) if (timelineState) { - // Handle a middle-mouse drag if one is occuring + // Handle a middle-mouse drag if one is occurring + /////////////////////////////TICKET #861 : shoudln't all of that be performed by TimelineViewWindow, instead of manipulating values from the outside? switch(dragType) { case Shift: diff --git a/src/gui/widgets/timeline/timeline-ruler.cpp b/src/gui/widgets/timeline/timeline-ruler.cpp index b8725aedf..532e461f7 100644 --- a/src/gui/widgets/timeline/timeline-ruler.cpp +++ b/src/gui/widgets/timeline/timeline-ruler.cpp @@ -274,6 +274,7 @@ TimelineRuler::draw_ruler(Cairo::RefPtr cr, REQUIRE(ruler_rect.get_width() > 0); REQUIRE(ruler_rect.get_height() > 0); + /////////////////////////////TICKET #861 : what part of these calculation could be centralised within TimelineViewWindow? const TimelineViewWindow &window = viewWindow(); const gavl_time_t left_offset = _raw(window.get_time_offset()); const int64_t time_scale = window.get_time_scale(); @@ -504,6 +505,7 @@ TimelineRuler::calculate_major_spacing() const { unsigned int i; + /////////////////////////////TICKET #861 : couldn't that be a library function in TimelineViewWindow? const gavl_time_t major_spacings[] = { GAVL_TIME_SCALE / 1000, GAVL_TIME_SCALE / 400, diff --git a/src/gui/widgets/timeline/timeline-view-window.cpp b/src/gui/widgets/timeline/timeline-view-window.cpp index 8b6528f11..c53722e89 100644 --- a/src/gui/widgets/timeline/timeline-view-window.cpp +++ b/src/gui/widgets/timeline/timeline-view-window.cpp @@ -88,9 +88,8 @@ void TimelineViewWindow::zoom_view(int point, double time_scale_ratio) { // Apply the smoothing factor - int64_t new_time_scale = - (int64_t)(pow(time_scale_ratio, TimelineWidget::ZoomSmoothing) * - (double)TimelineWidget::MaxScale); + int64_t new_time_scale(pow (time_scale_ratio, TimelineWidget::ZoomSmoothing) + * double(TimelineWidget::MaxScale)); /* Prevent Zooming in To Close and Far */ if(new_time_scale < 1) @@ -100,8 +99,7 @@ TimelineViewWindow::zoom_view(int point, double time_scale_ratio) new_time_scale = TimelineWidget::MaxScale; // The view must be shifted so that the zoom is centred on the cursor - TimeVar newStartPoint = get_time_offset(); - newStartPoint += TimeValue (point * (timeScale - new_time_scale)); + TimeVar newStartPoint = timeOffset + TimeValue(point * (timeScale - new_time_scale)); set_time_offset (newStartPoint); // Apply the new scale @@ -133,7 +131,5 @@ TimelineViewWindow::changed_signal() const return changedSignal; } -} // namespace timeline -} // namespace widgets -} // namespace gui +}}} // namespace gui::widgets::timeline diff --git a/src/gui/widgets/timeline/timeline-zoom-scale.cpp b/src/gui/widgets/timeline/timeline-zoom-scale.cpp index dfa71f858..02169dfdd 100644 --- a/src/gui/widgets/timeline/timeline-zoom-scale.cpp +++ b/src/gui/widgets/timeline/timeline-zoom-scale.cpp @@ -102,6 +102,7 @@ TimelineZoomScale::wireTimelineState (shared_ptr currentState, void TimelineZoomScale::on_timeline_state_changed (shared_ptr newState) { + /////////////////////////////TICKET #861 : part of that could be a library routine! REQUIRE (newState); timelineState = newState;