Timeline is no longer zoomed in to far on startup. See timline-view-window.hpp int64_t timeScale for explanation
This commit is contained in:
parent
b87b6078ad
commit
6c17d06e66
7 changed files with 52 additions and 40 deletions
|
|
@ -144,6 +144,7 @@ TimelinePanel::TimelinePanel (workspace::PanelManager &panel_manager,
|
||||||
update_tool_buttons();
|
update_tool_buttons();
|
||||||
update_zoom_buttons();
|
update_zoom_buttons();
|
||||||
show_time (Time::ZERO);
|
show_time (Time::ZERO);
|
||||||
|
std::cout << timelineWidget->get_state()->get_view_window().get_time_scale() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
|
|
@ -335,17 +336,17 @@ TimelinePanel::update_zoom_buttons()
|
||||||
{
|
{
|
||||||
REQUIRE(timelineWidget);
|
REQUIRE(timelineWidget);
|
||||||
|
|
||||||
const shared_ptr<timeline::TimelineState> state =
|
int64_t current_scale =
|
||||||
timelineWidget->get_state();
|
timelineWidget->get_state()->get_view_window().get_time_scale();
|
||||||
if(state)
|
|
||||||
{
|
|
||||||
timeline::TimelineViewWindow &viewWindow =
|
|
||||||
state->get_view_window();
|
|
||||||
|
|
||||||
zoomIn.set_sensitive(viewWindow.get_time_scale() != 1);
|
double linear_scale =
|
||||||
zoomOut.set_sensitive(viewWindow.get_time_scale()
|
(double) current_scale / (double) TimelineWidget::MaxScale;
|
||||||
!= TimelineWidget::MaxScale);
|
|
||||||
}
|
/* We have to Revese the Smoothing */
|
||||||
|
double new_relative_scale =
|
||||||
|
pow(linear_scale,(1.0/9.0));
|
||||||
|
|
||||||
|
timelineWidget->zoom_view (new_relative_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -180,8 +180,8 @@ IBeamTool::on_motion_notify_event(GdkEventMotion *event)
|
||||||
bool
|
bool
|
||||||
IBeamTool::on_scroll_slide_timer()
|
IBeamTool::on_scroll_slide_timer()
|
||||||
{
|
{
|
||||||
const Gdk::Rectangle body_rect(get_body_rectangle());
|
const Gdk::Rectangle body_rect (get_body_rectangle());
|
||||||
view_window().shift_view(body_rect.get_width(), scrollSlideRate);
|
view_window().shift_view (body_rect.get_width(), scrollSlideRate);
|
||||||
|
|
||||||
// Return true to keep the timer going
|
// Return true to keep the timer going
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -52,19 +52,18 @@ TimelineState::TimelineState (shared_ptr<model::Sequence> source_sequence)
|
||||||
{
|
{
|
||||||
REQUIRE(sequence);
|
REQUIRE(sequence);
|
||||||
|
|
||||||
// Initialize the listener
|
// Initialize the selection listener
|
||||||
selectionListener (TimeSpan (Time::ZERO, Duration::NIL));
|
selectionListener (TimeSpan (Time::ZERO, Duration::NIL));
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////TICKET #798: how to handle GUI default state
|
|
||||||
const int64_t DEFAULT_TIMELINE_SCALE =21000000;
|
|
||||||
|
|
||||||
viewWindow.set_time_scale(DEFAULT_TIMELINE_SCALE);
|
|
||||||
|
|
||||||
selectionListener.connect(
|
selectionListener.connect(
|
||||||
mem_fun(*this, &TimelineState::on_selection_changed));
|
mem_fun(*this, &TimelineState::on_selection_changed));
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////TICKET #798: how to handle GUI default state
|
||||||
|
const int64_t DEFAULT_TIMELINE_SCALE =6400;
|
||||||
|
|
||||||
|
viewWindow.set_time_scale(DEFAULT_TIMELINE_SCALE);
|
||||||
|
|
||||||
setSelection (Mutation::changeTime (Time(FSecs(2))));
|
setSelection (Mutation::changeTime (Time(FSecs(2))));
|
||||||
setSelection (Mutation::changeDuration(Duration(FSecs(2))));
|
setSelection (Mutation::changeDuration (Duration(FSecs(2))));
|
||||||
//////////////////////////////////////////////////////TICKET #797 : this is cheesy. Should provide a single Mutation to change all
|
//////////////////////////////////////////////////////TICKET #797 : this is cheesy. Should provide a single Mutation to change all
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ typedef Control<TimeSpan> SelectionControl;
|
||||||
* SelectionListener is a template class which emits a signal when
|
* SelectionListener is a template class which emits a signal when
|
||||||
* the value is changed by it's associated time::Control object.
|
* the value is changed by it's associated time::Control object.
|
||||||
* SelectionListener wraps a sigc::signal that emits every time
|
* SelectionListener wraps a sigc::signal that emits every time
|
||||||
* the selection is changed
|
* the selection is changed by the time::Control object.
|
||||||
|
* SelectionListener does NOT emit the signal if a change to the
|
||||||
|
* selection is made outside of the Control/Listener partnership.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<class TI>
|
template<class TI>
|
||||||
|
|
@ -66,7 +68,7 @@ class SelectionListener
|
||||||
void
|
void
|
||||||
operator() (TI const& changeValue) const
|
operator() (TI const& changeValue) const
|
||||||
{
|
{
|
||||||
valueChangedSignal.emit(changeValue);
|
valueChangedSignal.emit (changeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,13 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TimeVar timeOffset;
|
TimeVar timeOffset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scale of the Timline Body.
|
||||||
|
* @remarks This value represents the time span that is visible in
|
||||||
|
* the TimelineBodyWidget. Smaller numbers here will "zoom in"
|
||||||
|
* while larger numbers will "zoom out"
|
||||||
|
*/
|
||||||
int64_t timeScale;
|
int64_t timeScale;
|
||||||
|
|
||||||
sigc::signal<void> changedSignal;
|
sigc::signal<void> changedSignal;
|
||||||
|
|
|
||||||
|
|
@ -65,26 +65,27 @@ TimelineZoomScale::TimelineZoomScale()
|
||||||
, button_step_size(0.03)
|
, button_step_size(0.03)
|
||||||
{
|
{
|
||||||
/* Setup the Slider Control */
|
/* Setup the Slider Control */
|
||||||
slider.set_adjustment(adjustment);
|
slider.set_adjustment (adjustment);
|
||||||
slider.set_size_request(123,10);
|
slider.set_size_request (123,10);
|
||||||
slider.set_digits(6);
|
slider.set_digits (6);
|
||||||
slider.set_inverted(true);
|
|
||||||
slider.set_draw_value(false);
|
/* Inverted because smaller values "zoom in" */
|
||||||
|
slider.set_inverted (true);
|
||||||
|
|
||||||
|
slider.set_draw_value (false);
|
||||||
|
|
||||||
/* Make our connections */
|
/* Make our connections */
|
||||||
zoomIn.signal_clicked().
|
zoomIn.signal_clicked().
|
||||||
connect(sigc::mem_fun(this, &TimelineZoomScale::on_zoom_in_clicked));
|
connect (sigc::mem_fun(this, &TimelineZoomScale::on_zoom_in_clicked));
|
||||||
|
|
||||||
zoomOut.signal_clicked().
|
zoomOut.signal_clicked().
|
||||||
connect(sigc::mem_fun(this, &TimelineZoomScale::on_zoom_out_clicked));
|
connect (sigc::mem_fun(this, &TimelineZoomScale::on_zoom_out_clicked));
|
||||||
|
|
||||||
adjustment.signal_value_changed().
|
adjustment.signal_value_changed().
|
||||||
connect(sigc::mem_fun(this, &TimelineZoomScale::on_zoom));
|
connect (sigc::mem_fun(this, &TimelineZoomScale::on_zoom));
|
||||||
|
|
||||||
/* Add Our Widgets and show them */
|
/* Add Our Widgets and show them */
|
||||||
pack_start(zoomOut,PACK_SHRINK);
|
pack_start (zoomOut,PACK_SHRINK);
|
||||||
pack_start(slider,PACK_SHRINK);
|
pack_start (slider,PACK_SHRINK);
|
||||||
pack_start(zoomIn,PACK_SHRINK);
|
pack_start (zoomIn,PACK_SHRINK);
|
||||||
|
|
||||||
show_all();
|
show_all();
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +95,8 @@ TimelineZoomScale::wireTimelineState (shared_ptr<TimelineState> currentState,
|
||||||
TimelineWidget::TimelineStateChangeSignal stateChangeSignal)
|
TimelineWidget::TimelineStateChangeSignal stateChangeSignal)
|
||||||
{
|
{
|
||||||
on_timeline_state_changed (currentState);
|
on_timeline_state_changed (currentState);
|
||||||
stateChangeSignal.connect (sigc::mem_fun(this, &TimelineZoomScale::on_timeline_state_changed));
|
stateChangeSignal.connect (
|
||||||
|
sigc::mem_fun(this, &TimelineZoomScale::on_timeline_state_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -110,7 +112,6 @@ TimelineZoomScale::on_timeline_state_changed (shared_ptr<TimelineState> newState
|
||||||
(double) current_scale / (double) TimelineWidget::MaxScale;
|
(double) current_scale / (double) TimelineWidget::MaxScale;
|
||||||
|
|
||||||
/* We have to Revese the Smoothing */
|
/* We have to Revese the Smoothing */
|
||||||
TODO("Find a central place for ZoomSmoothingFactor Variable. right now it is 9.0");
|
|
||||||
double new_relative_scale =
|
double new_relative_scale =
|
||||||
pow(linear_scale,(1.0/9.0));
|
pow(linear_scale,(1.0/9.0));
|
||||||
|
|
||||||
|
|
@ -134,7 +135,7 @@ TimelineZoomScale::on_zoom_out_clicked()
|
||||||
void
|
void
|
||||||
TimelineZoomScale::on_zoom()
|
TimelineZoomScale::on_zoom()
|
||||||
{
|
{
|
||||||
zoomSignal.emit(adjustment.get_value()) ;
|
zoomSignal.emit (adjustment.get_value()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigc::signal<void, double>
|
sigc::signal<void, double>
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ public:
|
||||||
*/
|
*/
|
||||||
sigc::signal<void, double> signal_zoom();
|
sigc::signal<void, double> signal_zoom();
|
||||||
|
|
||||||
|
void set_value(double val) { adjustment.set_value(val); }
|
||||||
|
|
||||||
void wireTimelineState (shared_ptr<TimelineState> currentState,
|
void wireTimelineState (shared_ptr<TimelineState> currentState,
|
||||||
TimelineWidget::TimelineStateChangeSignal);
|
TimelineWidget::TimelineStateChangeSignal);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue