ZoomScale: rely on the state change signal for the view window
This commit is contained in:
parent
5905fdf0cb
commit
5fe1debd5b
4 changed files with 27 additions and 16 deletions
|
|
@ -112,7 +112,7 @@ TimelinePanel::TimelinePanel (workspace::PanelManager &panel_manager,
|
|||
panelBar.pack_start(toolbar, PACK_SHRINK);
|
||||
|
||||
// Setup tooltips
|
||||
sequenceChooser .set_tooltip_text(_("Change sequence"));
|
||||
sequenceChooser .set_tooltip_text(_("Change sequence"));
|
||||
|
||||
previousButton .set_tooltip_text(_("To beginning"));
|
||||
rewindButton .set_tooltip_text(_("Rewind"));
|
||||
|
|
@ -129,15 +129,15 @@ TimelinePanel::TimelinePanel (workspace::PanelManager &panel_manager,
|
|||
zoomScale .set_tooltip_text(_("Adjust timeline zoom scale"));
|
||||
|
||||
// Setup the timeline widget
|
||||
shared_ptr<Sequence> sequence ///////////////////////////////TICKET #796
|
||||
shared_ptr<Sequence> sequence ///////////////////////////////TICKET #796 : should use std::tr1::shared_ptr instead of boost
|
||||
= *get_project().get_sequences().begin();
|
||||
timelineWidget.reset(new TimelineWidget(load_state(sequence)));
|
||||
pack_start(*timelineWidget, PACK_EXPAND_WIDGET);
|
||||
|
||||
// TimelineWidget is now initialized, lets set it in the zoomScale
|
||||
// and wire it with the timeline state changed signal
|
||||
zoomScale.set_view_window(timelineWidget->get_state()->get_view_window());
|
||||
zoomScale.wireTimelineState (timelineWidget->state_changed_signal());
|
||||
// since TimelineWidget is now initialised,
|
||||
// wire the zoom slider to react on timeline state changes
|
||||
zoomScale.wireTimelineState (timelineWidget->get_state(),
|
||||
timelineWidget->state_changed_signal());
|
||||
|
||||
|
||||
// Set the initial UI state
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ private:
|
|||
boost::scoped_ptr<TimelineWidget> timelineWidget;
|
||||
|
||||
std::map< boost::weak_ptr<model::Sequence>,
|
||||
boost::shared_ptr<widgets::timeline::TimelineState> > ///////////////////////////////TICKET #796
|
||||
boost::shared_ptr<widgets::timeline::TimelineState> > ///////////////////////////////TICKET #796 : should use std::tr1::shared_ptr
|
||||
timelineStates;
|
||||
|
||||
// Toolbar Widgets
|
||||
|
|
|
|||
|
|
@ -91,8 +91,10 @@ TimelineZoomScale::TimelineZoomScale()
|
|||
}
|
||||
|
||||
void
|
||||
TimelineZoomScale::wireTimelineState (TimelineWidget::TimelineStateChangeSignal stateChangeSignal)
|
||||
TimelineZoomScale::wireTimelineState (boost::shared_ptr<TimelineState> currentState,
|
||||
TimelineWidget::TimelineStateChangeSignal stateChangeSignal)
|
||||
{
|
||||
on_timeline_state_changed (currentState);
|
||||
stateChangeSignal.connect (sigc::mem_fun(this, &TimelineZoomScale::on_timeline_state_changed));
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +102,9 @@ void
|
|||
TimelineZoomScale::on_timeline_state_changed (boost::shared_ptr<TimelineState> newState)
|
||||
{
|
||||
REQUIRE (newState);
|
||||
UNIMPLEMENTED ("react on the timeline state change");
|
||||
timelineState = newState;
|
||||
|
||||
UNIMPLEMENTED ("react on the timeline state change"); ///////////////////////////TODO
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -129,11 +133,14 @@ TimelineZoomScale::signal_zoom()
|
|||
return zoomSignal;
|
||||
}
|
||||
|
||||
void
|
||||
TimelineZoomScale::set_view_window(TimelineViewWindow &view_window)
|
||||
TimelineViewWindow&
|
||||
TimelineZoomScale::getViewWindow()
|
||||
{
|
||||
timelineViewWindow =& view_window;
|
||||
REQUIRE (timelineState, "lifecycle error");
|
||||
return timelineState->get_view_window();
|
||||
}
|
||||
|
||||
|
||||
int64_t
|
||||
TimelineZoomScale::calculate_zoom_scale()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "gui/gtk-lumiera.hpp"
|
||||
#include "gui/widgets/mini-button.hpp"
|
||||
#include "gui/widgets/timeline-widget.hpp"
|
||||
#include "gui/widgets/timeline/timeline-state.hpp"
|
||||
#include "gui/widgets/timeline/timeline-view-window.hpp"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
|
@ -54,8 +55,8 @@ public:
|
|||
*/
|
||||
sigc::signal<void, int64_t> signal_zoom();
|
||||
|
||||
void set_view_window(TimelineViewWindow &view_window);
|
||||
void wireTimelineState (TimelineWidget::TimelineStateChangeSignal);
|
||||
void wireTimelineState (boost::shared_ptr<TimelineState> currentState,
|
||||
TimelineWidget::TimelineStateChangeSignal);
|
||||
|
||||
private:
|
||||
/* Event Handlers */
|
||||
|
|
@ -83,6 +84,9 @@ private:
|
|||
*/
|
||||
void on_zoom();
|
||||
|
||||
/** access current timeline state */
|
||||
TimelineViewWindow& getViewWindow();
|
||||
|
||||
/**
|
||||
* Calculate a Zoom Scale value based on
|
||||
* the adjustment's current value
|
||||
|
|
@ -96,14 +100,14 @@ private:
|
|||
MiniButton zoomIn;
|
||||
MiniButton zoomOut;
|
||||
|
||||
protected:
|
||||
private:
|
||||
/* Signals */
|
||||
sigc::signal<void, int64_t> zoomSignal;
|
||||
|
||||
const double smoothing_factor;
|
||||
const double button_step_size;
|
||||
|
||||
TimelineViewWindow *timelineViewWindow;
|
||||
boost::shared_ptr<TimelineState> timelineState;
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
|
|
|
|||
Loading…
Reference in a new issue