diff --git a/src/stage/timeline/clip-widget.cpp b/src/stage/timeline/clip-widget.cpp index e8d2c8b52..eecce3027 100644 --- a/src/stage/timeline/clip-widget.cpp +++ b/src/stage/timeline/clip-widget.cpp @@ -335,7 +335,7 @@ namespace timeline { } /** state switch ctor */ - ClipWidget(ClipData&& existing, WidgetHook* newView) + ClipWidget(ClipData&& existing, WidgetHook* newView =nullptr) : HookedWidget{existing.establishHookPoint(newView), existing.getClipName()} , ClipData{std::move (existing)} { @@ -345,21 +345,28 @@ namespace timeline { inline ClipDelegate* - buildDelegateFor (Mode newMode, ClipDelegate& existingDelegate, WidgetHook* newView =0) - { - REQUIRE (INSTANCEOF (ClipData, &existingDelegate)); - ClipData& clipData = static_cast (existingDelegate); - - switch (newMode) - { - case HIDDEN: - return new DormantClip (std::move (clipData)); - case INDIVIDUAL: - return new ClipWidget (std::move (clipData), newView); - case SUMMARY: - UNIMPLEMENTED ("Summary/Overview presentation style"); - } - } + buildDelegateFor (Mode newMode, ClipDelegate& existingDelegate, WidgetHook* newView =nullptr) + { + REQUIRE (INSTANCEOF (ClipData, &existingDelegate)); + ClipData& clipData = static_cast (existingDelegate); + + switch (newMode) + { + case HIDDEN: + return new DormantClip (std::move (clipData)); + case INDIVIDUAL: + return new ClipWidget (std::move (clipData), newView); + case SUMMARY: + UNIMPLEMENTED ("Summary/Overview presentation style"); + } + } + + /** special convention to suppress a clip with start time == Time::NEVER */ + inline bool + canShow (Time start) + { + return start != Time::NEVER; + } }//(End)clip appearance details. @@ -367,27 +374,10 @@ namespace timeline { /* === Appearance Style state transitions === */ - ClipDelegate::Appearance - ClipDelegate::switchAppearance (PDelegate& manager, Appearance desired, WidgetHook* newView) - { - REQUIRE (manager, "pre-existing clip delegate required"); - Mode curMode = classify (manager->currentAppearance()); - Mode newMode = classify (desired); - if (newMode != curMode or newView) - { // need to switch the clip delegate - PDelegate newState (buildDelegateFor (newMode, *manager, newView)); - swap (manager, newState); - return manager->changeAppearance (desired); - } - else - return manager->changeAppearance (desired); - } - - ClipDelegate::Appearance ClipDelegate::buildDelegate (PDelegate& manager, WidgetHook& view, optional const& timing) { - if (timing) + if (timing and canShow (timing->start())) manager.reset (new ClipWidget{view.hookedAt(*timing, defaultOffsetY), *timing, defaultName}); else manager.reset (new DormantClip{view}); @@ -397,6 +387,25 @@ namespace timeline { } + ClipDelegate::Appearance + ClipDelegate::switchAppearance (PDelegate& existing, Appearance desired, WidgetHook* newView) + { + REQUIRE (existing, "pre-existing clip delegate required"); + if (not canShow(existing->getStartTime())) + desired = Appearance::PENDING; + Mode curMode = classify (existing->currentAppearance()); + Mode newMode = classify (desired); + if (newMode != curMode or newView) + { // need to switch the clip delegate + PDelegate newState (buildDelegateFor (newMode, *existing, newView)); + swap (existing, newState); + return existing->changeAppearance (desired); + } + else + return existing->changeAppearance (desired); + } + + WidgetHook::Pos ClipDelegate::establishHookPoint (WidgetHook* newView) { diff --git a/src/stage/timeline/clip-widget.hpp b/src/stage/timeline/clip-widget.hpp index f64d19a84..db63b56cc 100644 --- a/src/stage/timeline/clip-widget.hpp +++ b/src/stage/timeline/clip-widget.hpp @@ -200,7 +200,7 @@ namespace timeline { /** request to change the clip delegate's appearance style, if possible. - * @param manager entity to hold and maintain this specific appearance state. + * @param existing entity to hold and maintain this specific appearance state. * @param desired the intended style or mode to acquire * @param newView (optionally) a different view to hook up the delegate. * @return the actual mode the presentation was switched to @@ -220,7 +220,7 @@ namespace timeline { * The base ctor #ClipData(WidgetHook&) ensures there is * always a display_ (WidgetHook) to refer to. */ - static Appearance switchAppearance (PDelegate& manager, + static Appearance switchAppearance (PDelegate& existing, Appearance desired =PENDING, WidgetHook* newView =nullptr); diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index e8e7ba6dd..70c5079c6 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -6907,7 +6907,7 @@ - + @@ -21891,9 +21891,9 @@ - - - + + + @@ -22030,7 +22030,7 @@ - + @@ -22090,15 +22090,15 @@ - + - - + + - + @@ -22157,7 +22157,7 @@ - + @@ -22175,7 +22175,7 @@ - + @@ -22190,9 +22190,10 @@ - - - + + + + @@ -22330,8 +22331,7 @@ Aber der Punkt ist, nach der reinen Lehre sollte eine solche Funktion eine Options-Monade zurückgeben. Aber ich wollte stattdessen den guten alten Fallback-Wert. Wenn man das erst mal akzeptiert, dann muß "man" verdammt noch einmal auch die Wertebereiche ernst nehmen

- -
+
@@ -22356,6 +22356,7 @@
+ @@ -22407,6 +22408,7 @@ + @@ -22428,6 +22430,25 @@ + + + + + + + + + + + + + + + + + + + @@ -23489,11 +23510,11 @@ - + - + @@ -23574,9 +23595,9 @@ - + - + @@ -28357,9 +28378,9 @@ - + - + @@ -28375,17 +28396,16 @@ - + - + - - + + - - - + + @@ -28399,7 +28419,8 @@ - + + @@ -28513,9 +28534,9 @@ - - - + + + @@ -28588,7 +28609,7 @@ - + @@ -28809,16 +28830,16 @@ - + - - - + + + @@ -28827,9 +28848,9 @@ - + - + @@ -29454,7 +29475,7 @@ - + @@ -29547,8 +29568,8 @@ - - + + @@ -29565,9 +29586,9 @@ - - - + + + @@ -31322,7 +31343,7 @@ - +