From 03c358fe86a338b5b973b4cb4e32f7eccfe47c75 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 7 Sep 2019 19:24:54 +0200 Subject: [PATCH] Timeline: squeeze in some test/diagnostics code to inject a button onto each track This is dummy/test/diagnostics code and should be removed when the track display code is complete! It can be activated by sending a "mark"-Message via the UI-Bus, towards the Timeline element to be tested (Tip: use the same ID as used when injecting the Timeline via the TestControl Dialog box). When receiving this message (asynchronously), the TimelineControler asks each nested TrackPresnter to inject a Button with the corresponding track name onto the BodyCanvasWidget. This allows us to verify the coordinate calculation and size allocation -- and indeed, the numbers are not yet correct (TODO) --- src/stage/dialog/test-control.hpp | 33 ++++++- src/stage/timeline/body-canvas-widget.cpp | 18 ++++ src/stage/timeline/body-canvas-widget.hpp | 3 + src/stage/timeline/timeline-controller.cpp | 20 +++- src/stage/timeline/timeline-controller.hpp | 7 ++ src/stage/timeline/timeline-layout.hpp | 3 + src/stage/timeline/track-body.cpp | 3 + src/stage/timeline/track-body.hpp | 3 + src/stage/timeline/track-presenter.cpp | 12 +++ src/stage/timeline/track-presenter.hpp | 11 ++- wiki/thinkPad.ichthyo.mm | 103 +++++++++++++++++++-- 11 files changed, 201 insertions(+), 15 deletions(-) diff --git a/src/stage/dialog/test-control.hpp b/src/stage/dialog/test-control.hpp index 6d212a58d..f8e95795e 100644 --- a/src/stage/dialog/test-control.hpp +++ b/src/stage/dialog/test-control.hpp @@ -285,9 +285,18 @@ namespace dialog { { Gtk::Entry dummy_; FrameBox part_1_{_("populate"), Gtk::ORIENTATION_HORIZONTAL}, - part_2_{_("modify content")}; + part_2_{_("modify content")}, +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + part_3_{_("send UI-Bus Mess"), Gtk::ORIENTATION_HORIZONTAL} +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + ; Gtk::Button seq_1_, seq_2_; Gtk::Button mut_1_; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + Gtk::Button bus_1_; + Gtk::Entry bus_id_; + Gtk::Entry bus_msg_; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this string pickDummyID() @@ -325,6 +334,28 @@ namespace dialog { pack_start (part_1_, Gtk::PACK_SHRINK); pack_start (part_2_, Gtk::PACK_SHRINK); +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + bus_1_.set_label("UIBus::mark"); + bus_id_.set_tooltip_markup("UI-Bus ID of the receiver\n" + "Tip: the same ID as used when injecting the sequence...\n" + "(use the dummy ID value above!)"); + bus_msg_.set_tooltip_markup("magic payload to deliver to this UI-Element...."); + part_3_.pack_start (bus_1_, Gtk::PACK_SHRINK); + part_3_.pack_start (bus_id_, Gtk::PACK_SHRINK); + part_3_.pack_start (bus_msg_, Gtk::PACK_SHRINK); + pack_start (part_3_, Gtk::PACK_SHRINK); + // cast a UI-Bus message... + // also works from within the UI-Thread (which will perform this lambda when button is clicked)... + bus_1_.signal_clicked().connect( + [&]{ + // since this is not a real timeline existing somewhere in the session + // we use a cheesy way to fake a proper element-ID for addressing on the UI-Bus. + auto dummyRecord = lib::diff::MakeRec().genNode(bus_id_.get_text()); + // now send a "mark" message. It is up to the receiver to interpret it's ID as action. Typically the payload is irrelevant. + GuiNotification::facade().mark (dummyRecord.idi, GenNode{string{bus_msg_.get_text()}, 49 /*some irrelevant payload*/} ); + }); + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this // define the action triggers... seq_1_.signal_clicked().connect( diff --git a/src/stage/timeline/body-canvas-widget.cpp b/src/stage/timeline/body-canvas-widget.cpp index 45d84af76..8a35a223b 100644 --- a/src/stage/timeline/body-canvas-widget.cpp +++ b/src/stage/timeline/body-canvas-widget.cpp @@ -42,6 +42,9 @@ #include "common/advice.hpp" #include "lib/util.hpp" +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this +#include "lib/format-cout.hpp" +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this //#include //#include @@ -510,6 +513,21 @@ namespace timeline { adjust (rulerCanvas_, canvasWidth, rulerHeight); adjust (mainCanvas_, canvasWidth, max(0, totalHeight-rulerHeight)); } +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this +/// +/// + void + BodyCanvasWidget::DEBUG_injectTrackLabel (cuString const& trackName, int startLine) + { + Gtk::Button* butt = Gtk::manage (new Gtk::Button{trackName}); + butt->signal_clicked().connect( + [butt]{ cout << "|=="<get_label()<show(); + } +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this diff --git a/src/stage/timeline/body-canvas-widget.hpp b/src/stage/timeline/body-canvas-widget.hpp index e58b5b3cf..6a8238ea5 100644 --- a/src/stage/timeline/body-canvas-widget.hpp +++ b/src/stage/timeline/body-canvas-widget.hpp @@ -131,6 +131,9 @@ namespace timeline { /** a way to get and possibly (re)compute the current TrackProfile */ using ProfileGetter = std::function; ProfileGetter getProfile; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + void DEBUG_injectTrackLabel(cuString const& trackName, int startLine); +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this private:/* ===== Internals ===== */ diff --git a/src/stage/timeline/timeline-controller.cpp b/src/stage/timeline/timeline-controller.cpp index 5696863e1..06cb04ed9 100644 --- a/src/stage/timeline/timeline-controller.cpp +++ b/src/stage/timeline/timeline-controller.cpp @@ -44,6 +44,9 @@ #include "stage/timeline/timeline-controller.hpp" #include "stage/timeline/track-presenter.hpp" #include "stage/timeline/marker-widget.hpp" +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this +#include "stage/timeline/body-canvas-widget.hpp" +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this //#include "stage/workspace/workspace-window.hpp" //#include "stage/ui-bus.hpp" @@ -90,6 +93,9 @@ namespace timeline { { layoutManager.installRootTrack (head, body); }}} +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + , DEBUG_canvas_{layoutManager.exposeCanvasForDebug()} +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this { } @@ -97,7 +103,19 @@ namespace timeline { { } - + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + void + TimelineController::doMark (GenNode const& mark) + { + if (mark.idi.getSym() == "test" && this->fork_) + { + this->fork_->injectDebugTrackLabels(DEBUG_canvas_); + } + else // forward to default handler + model::Controller::doMark (mark); + } +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this /** * @internal this method is invoked by the UI-Bus when dispatching a MutationMessage... * @remarks this is likely the first occasion a casual reader sees such a binding function, diff --git a/src/stage/timeline/timeline-controller.hpp b/src/stage/timeline/timeline-controller.hpp index 84c28e851..809e276f4 100644 --- a/src/stage/timeline/timeline-controller.hpp +++ b/src/stage/timeline/timeline-controller.hpp @@ -74,6 +74,9 @@ namespace timeline { class TrackPresenter; class TimelineLayout; class MarkerWidget; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + class BodyCanvasWidget; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this /** @@ -119,6 +122,10 @@ namespace timeline { public: /* ===== Signals ===== */ private:/* ===== Events ===== */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + virtual void doMark (GenNode const& mark) override; + BodyCanvasWidget& DEBUG_canvas_; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this private:/* ===== Internals ===== */ }; diff --git a/src/stage/timeline/timeline-layout.hpp b/src/stage/timeline/timeline-layout.hpp index 73488c71c..2f4186f3e 100644 --- a/src/stage/timeline/timeline-layout.hpp +++ b/src/stage/timeline/timeline-layout.hpp @@ -125,6 +125,9 @@ namespace timeline { void installRootTrack (TrackHeadWidget&,TrackBody&); Gtk::WidgetPath getBodyWidgetPath() const; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + BodyCanvasWidget& exposeCanvasForDebug() { return bodyCanvas_; } +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this protected:/* ==== Interface: LayoutManager===== */ diff --git a/src/stage/timeline/track-body.cpp b/src/stage/timeline/track-body.cpp index 32c9c08f9..37071785e 100644 --- a/src/stage/timeline/track-body.cpp +++ b/src/stage/timeline/track-body.cpp @@ -89,6 +89,9 @@ namespace timeline { TrackBody::setTrackName (cuString& trackName) { TODO ("is the track name of any relevance for the TrackBody widget?"); +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + this->TODO_trackName_ = trackName;; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this } diff --git a/src/stage/timeline/track-body.hpp b/src/stage/timeline/track-body.hpp index 03efb45c0..878f86099 100644 --- a/src/stage/timeline/track-body.hpp +++ b/src/stage/timeline/track-body.hpp @@ -139,6 +139,9 @@ namespace timeline { } friend class TrackPresenter; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + uString TODO_trackName_; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this }; diff --git a/src/stage/timeline/track-presenter.cpp b/src/stage/timeline/track-presenter.cpp index b43bdfd42..039c2cf58 100644 --- a/src/stage/timeline/track-presenter.cpp +++ b/src/stage/timeline/track-presenter.cpp @@ -37,6 +37,9 @@ #include "stage/gtk-base.hpp" #include "include/ui-protocol.hpp" #include "stage/timeline/track-presenter.hpp" +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this +#include "stage/timeline/body-canvas-widget.hpp" +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this //#include "stage/ui-bus.hpp" //#include "lib/format-string.hpp" @@ -78,6 +81,15 @@ namespace timeline { +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + void + TrackPresenter::injectDebugTrackLabels(BodyCanvasWidget& bodyCanvas) + { + bodyCanvas.DEBUG_injectTrackLabel (display_.body.TODO_trackName_, display_.body.startLine_ + display_.body.contentOffset_); + for (auto& subTrack : subFork_) + subTrack->injectDebugTrackLabels (bodyCanvas); + } +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this /** * @note we distinguish between the contents of our four nested child collections * based on the symbolic type field sent in the Record type within the diff representation diff --git a/src/stage/timeline/track-presenter.hpp b/src/stage/timeline/track-presenter.hpp index 8a917b3b8..3c591d5b5 100644 --- a/src/stage/timeline/track-presenter.hpp +++ b/src/stage/timeline/track-presenter.hpp @@ -66,6 +66,9 @@ namespace stage { namespace timeline { +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + class BodyCanvasWidget; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this using std::vector; using std::unique_ptr; @@ -140,14 +143,16 @@ namespace timeline { , subFork_{} , markers_{} , clips_{} - { - setTrackName (id.getSym()); // fallback initialise track-name from human-readable ID symbol + { + setTrackName (id.getSym()); // fallback initialise track-name from human-readable ID symbol } /** set up a binding to respond to mutation messages via UiBus */ virtual void buildMutator (lib::diff::TreeMutator::Handle) override; - +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + void injectDebugTrackLabels(BodyCanvasWidget&); +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this private:/* ===== Internals ===== */ diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index c900b42a8..ec3513235 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -38,8 +38,9 @@ - + + @@ -2541,7 +2542,7 @@ - + @@ -3050,9 +3051,10 @@ - + - + + @@ -3974,7 +3976,7 @@ - + @@ -5208,7 +5210,7 @@ - + @@ -5220,6 +5222,7 @@ + @@ -5524,7 +5527,8 @@

- + + @@ -5642,6 +5646,58 @@ + + + + + + + + +

+ TestControl Dialogbox +

+ + +
+ + + + + + + + + +

+ ...welche ad hoc mit beiläufig geschriebenem Debug/Test-Code belegt werden +

+ +
+ +
+ + + + + + + + + + + + +
+ + + + + + + + +
@@ -24047,14 +24103,31 @@ - + - + + + + + + + + + + + + + + + + + + @@ -24154,7 +24227,8 @@ - + + @@ -24168,6 +24242,15 @@ + + + + + + + + +