Clip: sort out access to the canvas abstraction

This commit is contained in:
Fischlurch 2020-04-06 23:10:53 +02:00
parent 765d124fff
commit ea3ea811bf
4 changed files with 17 additions and 23 deletions

View file

@ -157,7 +157,7 @@ namespace model {
protected:
Canvas&
getCanvas()
getCanvas() const
{
REQUIRE (INSTANCEOF(ViewHook<BASE>, &Hooked::getView() ));
return static_cast<Canvas&> (Hooked::getView());

View file

@ -86,7 +86,7 @@ namespace model {
public:
virtual ~ViewHook() { } ///< this is an interface
virtual void hook (WID& widget) =0;
virtual void hook (WID& widget) =0;
virtual void remove (WID& widget) =0;
virtual void rehook (WID& widget) noexcept =0;
@ -128,7 +128,8 @@ namespace model {
View* view_;
protected:
View& getView() { return *view_; }
View&
getView() const { return *view_; }
public:
template<typename...ARGS>

View file

@ -128,14 +128,7 @@ namespace timeline {
{
return unConst(this)->display_;
}
WidgetHook::Pos
establishHookPoint (WidgetHook* newView) const override
{
if (not newView)
newView = &display_;
return newView->hookedAt (getStartTime(), defaultOffsetY);
}
public:
ClipData(WidgetHook& displayAnchor)
@ -147,7 +140,7 @@ namespace timeline {
ClipData(ClipDelegate& existing)
: ClipDelegate{}
, display_{existing.getCanvas()}
{
{
TODO("copy further clip presentation properties");
}
};
@ -188,16 +181,8 @@ namespace timeline {
WidgetHook&
getCanvas() const override
{
UNIMPLEMENTED("sort the base access out"); //return static_cast<HookedWidget&> (unConst(*this)).getCanvas();
return HookedWidget::getCanvas();
}
WidgetHook::Pos
establishHookPoint (WidgetHook* newView) const override
{
if (not newView)
newView = &getCanvas();
return newView->hookedAt (getStartTime(), defaultOffsetY);
} ///////////////////////////////////////////////////////////////TICKET #1038 : TODO mostly duplicated implementation
public:
@ -210,7 +195,7 @@ namespace timeline {
ClipWidget(ClipDelegate& existing, WidgetHook* newView)
: HookedWidget{existing.establishHookPoint(newView), existing.getClipName()}
, ClipDelegate{}
{
{
TODO("copy further clip presentation properties");
}
};
@ -266,5 +251,13 @@ namespace timeline {
}
WidgetHook::Pos
ClipDelegate::establishHookPoint (WidgetHook* newView)
{
if (not newView)
newView = & getCanvas();
return newView->hookedAt (getStartTime(), defaultOffsetY);
}
}}// namespace stage::timeline

View file

@ -164,7 +164,7 @@ namespace timeline {
* @param newView (optional) new canvas; use existing if not given
* @return record defining the canvas and the coordinates thereon
*/
virtual WidgetHook::Pos establishHookPoint (WidgetHook* newView) const =0;
WidgetHook::Pos establishHookPoint (WidgetHook* newView);
/** request to change the clip delegate's appearance style, if possible.