From bd13df23085a4e6200b55a9ab618254f99605c27 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 12 Apr 2019 02:00:19 +0200 Subject: [PATCH] Timeline: establish wiring with the timeline DisplayManager --- src/stage/timeline/body-canvas-widget.cpp | 24 +++++-- src/stage/timeline/body-canvas-widget.hpp | 7 +- src/stage/timeline/display-manager.hpp | 24 ++++++- src/stage/timeline/timeline-layout.cpp | 16 ++++- src/stage/timeline/timeline-layout.hpp | 3 + wiki/thinkPad.ichthyo.mm | 87 +++++++++++++++++++++-- 6 files changed, 141 insertions(+), 20 deletions(-) diff --git a/src/stage/timeline/body-canvas-widget.cpp b/src/stage/timeline/body-canvas-widget.cpp index d8a25e506..51ba2a051 100644 --- a/src/stage/timeline/body-canvas-widget.cpp +++ b/src/stage/timeline/body-canvas-widget.cpp @@ -31,6 +31,7 @@ #include "stage/gtk-base.hpp" #include "stage/timeline/body-canvas-widget.hpp" +#include "stage/timeline/display-manager.hpp" #include "stage/timeline/track-profile.hpp" #include "stage/timeline/track-body.hpp" @@ -42,16 +43,19 @@ //#include //#include +#include //using util::_Fmt; //using util::contains; //using Gtk::Widget; +using Gdk::Rectangle; //using sigc::mem_fun; //using sigc::ptr_fun; //using std::cout; //using std::endl; +using std::move; namespace stage { @@ -64,7 +68,8 @@ namespace timeline { class TrackGroundingRenderer : public ProfileInterpreter { - CairoC cox; + CairoC cox_; + PixSpan display_; /** paint the top of the track body area @@ -125,18 +130,23 @@ namespace timeline { public: - TrackGroundingRenderer (CairoC currentDrawContext) - : cox{currentDrawContext} + TrackGroundingRenderer (CairoC currentDrawContext, PixSpan toShow) + : cox_{currentDrawContext} + , display_{move (toShow)} { } + + virtual ~TrackGroundingRenderer() { } }; } - TimelineCanvas::TimelineCanvas() + TimelineCanvas::TimelineCanvas (DisplayManager& displayManager) : Gtk::Layout{} + , layout_{displayManager} , rootBody_{nullptr} + , profile_{} { } @@ -144,9 +154,9 @@ namespace timeline { BodyCanvasWidget::~BodyCanvasWidget() { } - BodyCanvasWidget::BodyCanvasWidget () + BodyCanvasWidget::BodyCanvasWidget (DisplayManager& displayManager) : Gtk::ScrolledWindow{} - , canvas_{} + , canvas_{displayManager} { this->set_shadow_type(Gtk::SHADOW_IN); this->set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC); // always need a horizontal scrollbar @@ -251,7 +261,7 @@ namespace timeline { if (not profile_) rootBody_->establishTrackSpace (profile_); - TrackGroundingRenderer renderer{cox}; + TrackGroundingRenderer renderer{cox, layout_.getPixSpan()}; profile_.performWith (renderer); } /////////////////////////////////////////////TICKET #1039 : placeholder drawing diff --git a/src/stage/timeline/body-canvas-widget.hpp b/src/stage/timeline/body-canvas-widget.hpp index b24b193d4..c35ac325d 100644 --- a/src/stage/timeline/body-canvas-widget.hpp +++ b/src/stage/timeline/body-canvas-widget.hpp @@ -70,17 +70,20 @@ namespace stage { namespace timeline { + class DisplayManager; class TrackBody; class TimelineCanvas : public Gtk::Layout { + DisplayManager& layout_; + public: TrackBody* rootBody_; TrackProfile profile_; - TimelineCanvas(); + TimelineCanvas (DisplayManager&); private: virtual bool on_draw (Cairo::RefPtr const&) override; @@ -102,7 +105,7 @@ namespace timeline { TimelineCanvas canvas_; public: - BodyCanvasWidget(); + BodyCanvasWidget (DisplayManager&); ~BodyCanvasWidget(); /** @internal Initially install the contents corresponding to the root track fork */ diff --git a/src/stage/timeline/display-manager.hpp b/src/stage/timeline/display-manager.hpp index 957fb5483..8dee060fd 100644 --- a/src/stage/timeline/display-manager.hpp +++ b/src/stage/timeline/display-manager.hpp @@ -58,7 +58,7 @@ #include "lib/error.hpp" #include "lib/nocopy.hpp" -//#include "lib/util.hpp" +#include "lib/util.hpp" //#include //#include @@ -68,9 +68,29 @@ namespace stage { namespace timeline { + using util::max; + // class TrackHeadWidget; + /** @todo quick-n-dirty hack. Should consider the Range TR (C++20) */ + struct PixSpan + { + int b = 0; + int e = 0; + + PixSpan() { } + PixSpan(int begin, int end) + : b{begin}, e{max (begin,end)} + { } + + bool + empty() const + { + return e <= b; + } + }; + /** * Interface used by the widgets to translate themselves into screen layout. * @todo WIP-WIP as of 11/2018 @@ -84,6 +104,8 @@ namespace timeline { public: virtual ~DisplayManager(); ///< this is an interface + /** the overall horizontal pixel span to cover by this timeline */ + virtual PixSpan getPixSpan() =0; private:/* ===== Internals ===== */ diff --git a/src/stage/timeline/timeline-layout.cpp b/src/stage/timeline/timeline-layout.cpp index 15db8a79d..d80e44613 100644 --- a/src/stage/timeline/timeline-layout.cpp +++ b/src/stage/timeline/timeline-layout.cpp @@ -63,8 +63,8 @@ namespace timeline { TimelineLayout::TimelineLayout (Gtk::Paned& topLevelContainer) : paneSplitPosition_{topLevelContainer.property_position()} - , bodyCanvas_{} - , headerPane_{bodyCanvas_.get_vadjustment()} // wire the header pane (Gtk::Viewport) to follow the body vertical scroll movement + , bodyCanvas_{*this} // inject (as interface DisplayManager) + , headerPane_{bodyCanvas_.get_vadjustment()} // wire the header pane (Gtk::Viewport) to follow the body vertical scroll movement { topLevelContainer.add1 (headerPane_); topLevelContainer.add2 (bodyCanvas_); @@ -86,7 +86,17 @@ namespace timeline { bodyCanvas_.installForkRoot (body); } - + + /* ==== Interface: LayoutManager===== */ + + PixSpan + TimelineLayout::getPixSpan() + { + ////////////////////////////////////////////////////////TICKET 1019 : need a "ZoomWindow" here to manage the visible area + ////////////////////////////////////////////////////////TICKET 1039 : "somehow" wire with the TimelineController to find out the covered span + return PixSpan {0, 2048}; ////////////////Lalala Lalü + } + diff --git a/src/stage/timeline/timeline-layout.hpp b/src/stage/timeline/timeline-layout.hpp index 155c2e07f..2b6a5e484 100644 --- a/src/stage/timeline/timeline-layout.hpp +++ b/src/stage/timeline/timeline-layout.hpp @@ -115,6 +115,7 @@ namespace timeline { BodyCanvasWidget bodyCanvas_; HeaderPaneWidget headerPane_; + /////////////////////////////////////////////////////////////////////////////////////////////TICKET 1019 : need a "ZoomWindow" here to manage the visible area public: TimelineLayout (Gtk::Paned&); @@ -125,6 +126,8 @@ namespace timeline { protected:/* ==== Interface: LayoutManager===== */ + PixSpan getPixSpan() override; + private:/* ===== Internals ===== */ }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 1c3a81f15..cb6dc19ca 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -19111,6 +19111,30 @@ + + + + + + + + +

+ es ist hier kein by-Name-Zugriff, +

+

+ weil ein Layout-Manager immer nur im Bereich eines TimelineWidget relevant ist +

+ + +
+
+ + + + + +
@@ -19461,8 +19485,8 @@
- - + + @@ -19531,6 +19555,20 @@ + + + + + + + +

+ das ist ein reiner (pesistent) presentation state +

+ + +
+
@@ -19621,7 +19659,7 @@ - + @@ -19633,9 +19671,19 @@ - + + + + + + + + + + + @@ -19658,6 +19706,28 @@ + + + + + + + + + + + +

+ wir können nicht von 0 bis MAXINT zeichnen +

+ + +
+
+ + + +
@@ -19675,7 +19745,10 @@ - + + + + @@ -22037,8 +22110,8 @@
- - + +