From ec504071671ff0848d503ef2bc506b3a780c8677 Mon Sep 17 00:00:00 2001
From: Ichthyostega
Date: Sun, 14 Jul 2019 17:53:21 +0200
Subject: [PATCH] Timeline: start implementing some bits of the drawing code
Use a "catchy" style definition with lime background to make the drawing visible
---
src/stage/lumiera-light-theme-complement.css | 13 ++
src/stage/timeline/body-canvas-widget.cpp | 57 ++++++--
src/stage/timeline/display-manager.hpp | 6 +
src/stage/timeline/track-profile.hpp | 3 +-
.../session/dummy-session-connection.cpp | 9 +-
.../session/dummy-session-connection.hpp | 1 -
tests/43session.tests | 5 -
.../session/dummy-session-connection-test.cpp | 87 ------------
wiki/thinkPad.ichthyo.mm | 126 ++++++++++++++++--
9 files changed, 186 insertions(+), 121 deletions(-)
delete mode 100644 tests/core/steam/mobject/session/dummy-session-connection-test.cpp
diff --git a/src/stage/lumiera-light-theme-complement.css b/src/stage/lumiera-light-theme-complement.css
index 1539e5609..06010cc4c 100644
--- a/src/stage/lumiera-light-theme-complement.css
+++ b/src/stage/lumiera-light-theme-complement.css
@@ -31,3 +31,16 @@
.indication_flash text {
border: 4px solid red;
}
+
+/* profile structure of the track fork...
+ * within the timeline body display (right side)
+ *
+ * margin is used for padding above / below
+ * border is used to paint the slopes to nested scopes
+ * background is used within the track scopes
+ */
+ .timeline-page > .timeline-body fork.timeline {
+ margin: 2ex 0;
+ border: 5px inset;
+ background-color: lime;
+}
diff --git a/src/stage/timeline/body-canvas-widget.cpp b/src/stage/timeline/body-canvas-widget.cpp
index 96b24164b..95e0cb34a 100644
--- a/src/stage/timeline/body-canvas-widget.cpp
+++ b/src/stage/timeline/body-canvas-widget.cpp
@@ -83,14 +83,28 @@ namespace timeline {
StyleC style_;
PixSpan visible_;
+ /** the current "water level".
+ * To be updated while drawing top-down */
+ int line_ = 0;
+
/** paint the top of the track body area
* @param f number of consecutive track elements
- * to keep pinned (always visible) at top */
+ * to keep pinned (always visible) at top
+ * @todo argument doesn't belong here
+ */
void
- prelude (uint f) override
+ prelude (uint) override
{
- UNIMPLEMENTED ("draw timeline top");
+ int topMargin = style_->get_margin().get_top();
+ style_->render_background (cox_
+ ,visible_.b // left start of the rectangle
+ ,line_ // top of the rectangle
+ ,visible_.delta() // width of the area
+ ,topMargin // height to fill
+ );
+ line_ += topMargin;
+ line_ += 5; //////////////////////////////////////////////////////////////////TODO: visual debugging
}
/** finish painting the track body area
@@ -98,7 +112,14 @@ namespace timeline {
void
coda (uint pad) override
{
- UNIMPLEMENTED ("draw bottom");
+ int bottomPad = pad + style_->get_margin().get_bottom();
+ style_->render_background (cox_
+ ,visible_.b // left start of the rectangle
+ ,line_ // top of the rectangle
+ ,visible_.delta() // width of the area
+ ,bottomPad // height to fill
+ );
+ line_ += bottomPad;
}
/** draw grounding of an overview/ruler track
@@ -121,7 +142,14 @@ namespace timeline {
void
content (uint h) override
{
- UNIMPLEMENTED ("paint background of content area");
+ style_->render_background (cox_
+ ,visible_.b // left start of the rectangle
+ ,line_ // top of the rectangle
+ ,visible_.delta() // width of the area
+ ,h // height to fill
+ );
+ line_ += h;
+ line_ += 8; //////////////////////////////////////////////////////////////////TODO: visual debugging
}
/** paint opening slope to enter nested sub tracks
@@ -155,16 +183,22 @@ namespace timeline {
: public ProfileInterpreter
{
CairoC cox_;
+ StyleC style_;
PixSpan visible_;
+ int line_ = 0;
+
/** overlays to show at top of the track body area
* @param f number of consecutive track elements
- * to keep pinned (always visible) at top */
+ * to keep pinned (always visible) at top
+ * @todo argument doesn't belong here
+ */
void
- prelude (uint f) override
+ prelude (uint) override
{
- UNIMPLEMENTED ("overlays for timeline top");
+ /* nothing to paint */
+ line_ += style_->get_margin().get_top();
}
/** finish painting overlays a the bottom of the track body area
@@ -172,7 +206,8 @@ namespace timeline {
void
coda (uint pad) override
{
- UNIMPLEMENTED ("overlays for bottom");
+ /* nothing to paint */
+ line_ += pad + style_->get_margin().get_bottom();
}
/** draw overlays on top of overview/ruler track
@@ -196,7 +231,8 @@ namespace timeline {
void
content (uint h) override
{
- UNIMPLEMENTED ("overlays for content area");
+ /* nothing to paint */
+ line_ += h;
}
/** render overlays covering the opening slope towards nested tracks */
@@ -217,6 +253,7 @@ namespace timeline {
public:
TrackOverlayRenderer (CairoC currentDrawContext, DisplayManager& layout)
: cox_{currentDrawContext}
+ , style_{trackBodyStyle.getAdvice()}
, visible_{layout.getPixSpan()}
{ }
};
diff --git a/src/stage/timeline/display-manager.hpp b/src/stage/timeline/display-manager.hpp
index b33c77d12..f61e959ac 100644
--- a/src/stage/timeline/display-manager.hpp
+++ b/src/stage/timeline/display-manager.hpp
@@ -91,6 +91,12 @@ namespace timeline {
{
return e <= b;
}
+
+ int
+ delta() const
+ {
+ return e - b;
+ }
};
/**
diff --git a/src/stage/timeline/track-profile.hpp b/src/stage/timeline/track-profile.hpp
index f2baea533..2115c58e6 100644
--- a/src/stage/timeline/track-profile.hpp
+++ b/src/stage/timeline/track-profile.hpp
@@ -68,7 +68,7 @@ namespace timeline {
virtual void content(uint h) =0; ///< represent a content area with the given vertical extension
virtual void open() =0; ///< indicate entering a nested structure, typically as 3D inset
virtual void close(uint n) =0; ///< indicate the end of `n` nested structures, typically by ascending back `n` levels
- virtual void prelude(uint f) =0; ///< start track presentation at top of the timeline, with `f` pinned (always visible) elements
+ virtual void prelude(uint f) =0; ///< start track presentation at top of the timeline, with `f` pinned (always visible) elements @todo argument doesn't belong here
virtual void coda(uint pad) =0; ///< the closing part of the timeline at the bottom of the track display, with `pad` additional padding
static const size_t MAX_ARG_SIZE = sizeof(size_t);
@@ -82,6 +82,7 @@ namespace timeline {
* To decouple the drawing code -- thus allowing for later customisations --
* we let the individual TrackBody elements just emit these structure description.
* @todo WIP-WIP as of 4/2019
+ * @todo the number of pinned elements should be a member field, instead of sneaking it into the prelude element...
*/
struct TrackProfile
{
diff --git a/src/steam/mobject/session/dummy-session-connection.cpp b/src/steam/mobject/session/dummy-session-connection.cpp
index 1b47fc950..9b91dad6b 100644
--- a/src/steam/mobject/session/dummy-session-connection.cpp
+++ b/src/steam/mobject/session/dummy-session-connection.cpp
@@ -31,7 +31,7 @@
**
** @todo WIP as of 10/2018 ///////////////////////TICKET #1042
**
- ** @see DummySessionConnection_test
+ ** @see [corresponding UI](\ref stage::dialog::TestControl)
**
*/
@@ -109,10 +109,9 @@ namespace session {
DummySessionConnection::fabricateSeq1 (string baseID)
{
const RandID forkRootID{stage::ATTR_fork};
- const GenNode timeline = emptyTimeline (baseID, forkRootID)
- , rootTrackName = GenNode{string{stage::ATTR_name}, "Track-"+baseID}
- , forkRoot = MakeRec().genNode(forkRootID)
- ;
+ const GenNode timeline = emptyTimeline (baseID, forkRootID);
+ const GenNode rootTrackName = GenNode{string{stage::ATTR_name}, "Track-"+baseID};
+ const GenNode forkRoot = MakeRec().genNode(forkRootID);
return MutationMessage{ ins (timeline)
, mut (timeline)
diff --git a/src/steam/mobject/session/dummy-session-connection.hpp b/src/steam/mobject/session/dummy-session-connection.hpp
index 18dce8545..8bd0c757d 100644
--- a/src/steam/mobject/session/dummy-session-connection.hpp
+++ b/src/steam/mobject/session/dummy-session-connection.hpp
@@ -83,7 +83,6 @@ namespace session {
* Stage-Layer and Steam-Layer, so the software gains some tangible functionality...
* @note readily-available singleton to enact prototypical behaviour as appropriate.
*
- * @see DummySessionConnection_test
* @see stage::interact::InteractionDirector::buildMutator
* @see stage::interact::InteractionDirector::injectTimeline
* @see stage::timeline::TimelineController
diff --git a/tests/43session.tests b/tests/43session.tests
index a8885dc2b..9713a2cc3 100644
--- a/tests/43session.tests
+++ b/tests/43session.tests
@@ -33,11 +33,6 @@ return: 0
END
-PLANNED "Scaffolding to develop the UI-Session connection" DummySessionConnection_test <
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-* *****************************************************/
-
-/** @file dummy-session-connection-test.cpp
- **
- */
-
-#include "lib/test/run.hpp"
-#include "lib/util.hpp"
-
-#include "steam/mobject/session/dummy-session-connection.hpp"
-
-//#include
-//#include
-#include
-#include
+
@@ -20912,7 +20913,7 @@
-
+
@@ -20959,10 +20960,17 @@