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 identity referring to the corresponding session::Clip in Steam-Layer.
|
||||||
* @param nexus a way to connect this Controller to the UI-Bus.
|
* @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 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}
|
: Controller{identity, nexus}
|
||||||
, channels_{}
|
, channels_{}
|
||||||
, effects_{}
|
, effects_{}
|
||||||
, markers_{}
|
, markers_{}
|
||||||
, widget_{}
|
, widget_{}
|
||||||
{
|
{
|
||||||
ClipDelegate::buildDelegate (widget_, view, offsetX);
|
ClipDelegate::buildDelegate (widget_, view, startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@
|
||||||
#include "stage/gtk-base.hpp"
|
#include "stage/gtk-base.hpp"
|
||||||
#include "stage/model/controller.hpp"
|
#include "stage/model/controller.hpp"
|
||||||
#include "stage/timeline/clip-widget.hpp"
|
#include "stage/timeline/clip-widget.hpp"
|
||||||
|
#include "lib/time/timevalue.hpp"
|
||||||
|
|
||||||
//#include "lib/util.hpp"
|
//#include "lib/util.hpp"
|
||||||
|
|
||||||
|
|
@ -70,6 +71,7 @@ namespace timeline {
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::optional;
|
using std::optional;
|
||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
|
using lib::time::Time;
|
||||||
|
|
||||||
class MarkerWidget;
|
class MarkerWidget;
|
||||||
|
|
||||||
|
|
@ -94,7 +96,7 @@ namespace timeline {
|
||||||
static const ClipDelegate::Appearance defaultAppearance = ClipDelegate::COMPACT;
|
static const ClipDelegate::Appearance defaultAppearance = ClipDelegate::COMPACT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClipPresenter (ID, ctrl::BusTerm&, WidgetHook&, optional<int> offsetX);
|
ClipPresenter (ID, ctrl::BusTerm&, WidgetHook&, optional<Time> startTime);
|
||||||
|
|
||||||
~ClipPresenter();
|
~ClipPresenter();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,12 +122,15 @@ namespace timeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipDelegate::Appearance
|
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)
|
if (startTime)
|
||||||
manager.reset (new ClipWidget{view.hookedAt(*startOffsetX, defaultOffsetY), defaultName});
|
manager.reset (new ClipWidget{view.hookedAt(*startTime, defaultOffsetY), defaultName});
|
||||||
else
|
else
|
||||||
manager.reset (new ClipData{view});
|
manager.reset (new ClipData{view});
|
||||||
|
|
||||||
|
return startTime? Appearance::COMPACT
|
||||||
|
: Appearance::PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@
|
||||||
|
|
||||||
#include "stage/gtk-base.hpp"
|
#include "stage/gtk-base.hpp"
|
||||||
#include "stage/model/canvas-hook.hpp"
|
#include "stage/model/canvas-hook.hpp"
|
||||||
|
#include "lib/time/timevalue.hpp"
|
||||||
|
|
||||||
//#include "lib/util.hpp"
|
//#include "lib/util.hpp"
|
||||||
|
|
||||||
|
|
@ -117,6 +118,7 @@ namespace stage {
|
||||||
namespace timeline {
|
namespace timeline {
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
using lib::time::Time;
|
||||||
|
|
||||||
using WidgetHook = model::CanvasHook<Gtk::Widget>;
|
using WidgetHook = model::CanvasHook<Gtk::Widget>;
|
||||||
|
|
||||||
|
|
@ -173,7 +175,7 @@ namespace timeline {
|
||||||
* viable appearance style. This is the first incantation of #switchAppearance.
|
* viable appearance style. This is the first incantation of #switchAppearance.
|
||||||
*/
|
*/
|
||||||
static Appearance buildDelegate (PDelegate& manager, WidgetHook& view,
|
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 ===== */
|
private:/* ===== Internals ===== */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,11 +126,6 @@ namespace timeline {
|
||||||
using PMark = unique_ptr<MarkerWidget>;
|
using PMark = unique_ptr<MarkerWidget>;
|
||||||
using PRuler = unique_ptr<RulerTrack>;
|
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.
|
* Reference frame to organise the presentation related to a specific Track in the Timeline-GUI.
|
||||||
|
|
@ -227,18 +222,6 @@ namespace timeline {
|
||||||
|
|
||||||
private:/* ===== Internals ===== */
|
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 */
|
/** invoked via diff to show a (changed) track name */
|
||||||
void
|
void
|
||||||
setTrackName (string name)
|
setTrackName (string name)
|
||||||
|
|
@ -331,8 +314,8 @@ namespace timeline {
|
||||||
})
|
})
|
||||||
.constructFrom ([&](GenNode const& spec) -> PClip
|
.constructFrom ([&](GenNode const& spec) -> PClip
|
||||||
{
|
{
|
||||||
std::optional<int> startOffsetX{extractStartOffset (spec)}; //////////////////////////TICKET #1213 : should pass the start time instead!!
|
std::optional<Time> startTime = spec.retrieveAttribute<Time> (string{ATTR_start});
|
||||||
return make_unique<ClipPresenter> (spec.idi, this->uiBus_, display_.getClipHook(), startOffsetX);
|
return make_unique<ClipPresenter> (spec.idi, this->uiBus_, display_.getClipHook(), startTime);
|
||||||
})
|
})
|
||||||
.buildChildMutator ([&](PClip& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
|
.buildChildMutator ([&](PClip& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue