Relative-Hook: now able to push down time->pixel translation (see #1213)
the actual translation is still TODO; we should delegate the calculation to the DisplayManager, which is in focus within the TrackBody, where the coordinate translation hook is now located.
This commit is contained in:
parent
e33eae729b
commit
cfa8e87931
5 changed files with 18 additions and 27 deletions
|
|
@ -68,16 +68,17 @@ namespace timeline {
|
|||
* @param identity referring to the corresponding session::Clip in Steam-Layer.
|
||||
* @param nexus a way to connect this Controller to the UI-Bus.
|
||||
* @param view (abstracted) canvas or display framework to attach this clip to
|
||||
* @param offsetX offset relative to the start of the track ///////////////////////////////TICKET #1213 : translation time->offset should be built into the ViewHook!!!
|
||||
* @param startTime (optional) start time point of the clip.
|
||||
* @note Clip can not be displayed unless startTime is given
|
||||
*/
|
||||
ClipPresenter::ClipPresenter (ID identity, ctrl::BusTerm& nexus, WidgetHook& view, optional<int> offsetX)
|
||||
ClipPresenter::ClipPresenter (ID identity, ctrl::BusTerm& nexus, WidgetHook& view, optional<Time> startTime)
|
||||
: Controller{identity, nexus}
|
||||
, channels_{}
|
||||
, effects_{}
|
||||
, markers_{}
|
||||
, widget_{}
|
||||
{
|
||||
ClipDelegate::buildDelegate (widget_, view, offsetX);
|
||||
ClipDelegate::buildDelegate (widget_, view, startTime);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
#include "stage/gtk-base.hpp"
|
||||
#include "stage/model/controller.hpp"
|
||||
#include "stage/timeline/clip-widget.hpp"
|
||||
#include "lib/time/timevalue.hpp"
|
||||
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
|
|
@ -70,6 +71,7 @@ namespace timeline {
|
|||
using std::vector;
|
||||
using std::optional;
|
||||
using std::unique_ptr;
|
||||
using lib::time::Time;
|
||||
|
||||
class MarkerWidget;
|
||||
|
||||
|
|
@ -94,7 +96,7 @@ namespace timeline {
|
|||
static const ClipDelegate::Appearance defaultAppearance = ClipDelegate::COMPACT;
|
||||
|
||||
public:
|
||||
ClipPresenter (ID, ctrl::BusTerm&, WidgetHook&, optional<int> offsetX);
|
||||
ClipPresenter (ID, ctrl::BusTerm&, WidgetHook&, optional<Time> startTime);
|
||||
|
||||
~ClipPresenter();
|
||||
|
||||
|
|
|
|||
|
|
@ -122,12 +122,15 @@ namespace timeline {
|
|||
}
|
||||
|
||||
ClipDelegate::Appearance
|
||||
ClipDelegate::buildDelegate (PDelegate& manager, WidgetHook& view, optional<int> startOffsetX) ////////////////TICKET #1213 : translation time->offset should be built into the ViewHook!!!
|
||||
ClipDelegate::buildDelegate (PDelegate& manager, WidgetHook& view, optional<Time> startTime)
|
||||
{
|
||||
if (startOffsetX)
|
||||
manager.reset (new ClipWidget{view.hookedAt(*startOffsetX, defaultOffsetY), defaultName});
|
||||
if (startTime)
|
||||
manager.reset (new ClipWidget{view.hookedAt(*startTime, defaultOffsetY), defaultName});
|
||||
else
|
||||
manager.reset (new ClipData{view});
|
||||
|
||||
return startTime? Appearance::COMPACT
|
||||
: Appearance::PENDING;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@
|
|||
|
||||
#include "stage/gtk-base.hpp"
|
||||
#include "stage/model/canvas-hook.hpp"
|
||||
#include "lib/time/timevalue.hpp"
|
||||
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
|
|
@ -117,6 +118,7 @@ namespace stage {
|
|||
namespace timeline {
|
||||
|
||||
using std::string;
|
||||
using lib::time::Time;
|
||||
|
||||
using WidgetHook = model::CanvasHook<Gtk::Widget>;
|
||||
|
||||
|
|
@ -173,7 +175,7 @@ namespace timeline {
|
|||
* viable appearance style. This is the first incantation of #switchAppearance.
|
||||
*/
|
||||
static Appearance buildDelegate (PDelegate& manager, WidgetHook& view,
|
||||
std::optional<int> startOffsetX); ///////////////////////TICKET #1213 : translation time->offset should be built into the ViewHook!!!
|
||||
std::optional<Time> startTime);
|
||||
|
||||
private:/* ===== Internals ===== */
|
||||
|
||||
|
|
|
|||
|
|
@ -126,11 +126,6 @@ namespace timeline {
|
|||
using PMark = unique_ptr<MarkerWidget>;
|
||||
using PRuler = unique_ptr<RulerTrack>;
|
||||
|
||||
namespace {
|
||||
const int TODO_px_per_second = 25;
|
||||
const int TODO_px_per_microtick = TODO_px_per_second / Time::SCALE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reference frame to organise the presentation related to a specific Track in the Timeline-GUI.
|
||||
|
|
@ -227,18 +222,6 @@ namespace timeline {
|
|||
|
||||
private:/* ===== Internals ===== */
|
||||
|
||||
/** try to extract the start coordinates from a given Diff spec */
|
||||
std::optional<int>
|
||||
extractStartOffset (GenNode const& spec)
|
||||
{
|
||||
auto startTime = spec.retrieveAttribute<Time> (string{ATTR_start});
|
||||
if (startTime)
|
||||
return TODO_px_per_microtick * _raw(*startTime); //////////////////////////////////////////////TICKET #1213 : need to abstract that away!!
|
||||
else
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
/** invoked via diff to show a (changed) track name */
|
||||
void
|
||||
setTrackName (string name)
|
||||
|
|
@ -331,8 +314,8 @@ namespace timeline {
|
|||
})
|
||||
.constructFrom ([&](GenNode const& spec) -> PClip
|
||||
{
|
||||
std::optional<int> startOffsetX{extractStartOffset (spec)}; //////////////////////////TICKET #1213 : should pass the start time instead!!
|
||||
return make_unique<ClipPresenter> (spec.idi, this->uiBus_, display_.getClipHook(), startOffsetX);
|
||||
std::optional<Time> startTime = spec.retrieveAttribute<Time> (string{ATTR_start});
|
||||
return make_unique<ClipPresenter> (spec.idi, this->uiBus_, display_.getClipHook(), startTime);
|
||||
})
|
||||
.buildChildMutator ([&](PClip& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue