review and annotate design aspects regarding zoom handling

This commit is contained in:
Fischlurch 2011-11-27 00:52:10 +01:00
parent d58fa9129c
commit a6392f5d14
6 changed files with 11 additions and 11 deletions

View file

@ -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*

View file

@ -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

View file

@ -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:

View file

@ -274,6 +274,7 @@ TimelineRuler::draw_ruler(Cairo::RefPtr<Cairo::Context> 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,

View file

@ -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

View file

@ -102,6 +102,7 @@ TimelineZoomScale::wireTimelineState (shared_ptr<TimelineState> currentState,
void
TimelineZoomScale::on_timeline_state_changed (shared_ptr<TimelineState> newState)
{
/////////////////////////////TICKET #861 : part of that could be a library routine!
REQUIRE (newState);
timelineState = newState;