From 116600b20a54ed631106876a607e80c7364a0c1b Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 24 Nov 2018 17:03:03 +0100 Subject: [PATCH] Timeline: draft a concept to attack the custom layout the core question is: how to translate time into pixel coordinates --- src/stage/model/zoom-window.cpp | 45 +++++++++ src/stage/model/zoom-window.hpp | 92 ++++++++++++++++++ src/stage/timeline/display-manager.cpp | 82 ++++++++++++++++ src/stage/timeline/display-manager.hpp | 94 +++++++++++++++++++ src/stage/timeline/timeline-layout.hpp | 4 + .../session/dummy-session-connection.cpp | 6 +- tests/stage/model/zoom-window-test.cpp | 93 ++++++++++++++++++ wiki/renderengine.html | 7 +- wiki/thinkPad.ichthyo.mm | 24 +++-- 9 files changed, 433 insertions(+), 14 deletions(-) create mode 100644 src/stage/model/zoom-window.cpp create mode 100644 src/stage/model/zoom-window.hpp create mode 100644 src/stage/timeline/display-manager.cpp create mode 100644 src/stage/timeline/display-manager.hpp create mode 100644 tests/stage/model/zoom-window-test.cpp diff --git a/src/stage/model/zoom-window.cpp b/src/stage/model/zoom-window.cpp new file mode 100644 index 000000000..de8edc351 --- /dev/null +++ b/src/stage/model/zoom-window.cpp @@ -0,0 +1,45 @@ +/* + ZoomWindow - generic translation from domain to screen coordinates + + Copyright (C) Lumiera.org + 2018, Hermann Vosseler + + 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 zoom-window.cpp + ** Common implementation details related to zoom handling and + ** transformation into screen coordinates. + ** + */ + + +#include "stage/model/zoom-window.hpp" +//#include "include/ui-protocol.hpp" +//#include "lib/diff/gen-node.hpp" + + +namespace stage { +namespace model { + + + + /** */ + + + +}} // namespace stage::model diff --git a/src/stage/model/zoom-window.hpp b/src/stage/model/zoom-window.hpp new file mode 100644 index 000000000..5ce69a53b --- /dev/null +++ b/src/stage/model/zoom-window.hpp @@ -0,0 +1,92 @@ +/* + ZOOM-WINDOW.hpp - generic translation from domain to screen coordinates + + Copyright (C) Lumiera.org + 2018, Hermann Vosseler + + 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 zoom-window.hpp + ** Abstraction: a multi-dimensional extract from model space into screen coordinates. + ** This is a generic component to represent and handle the zooming and positioning of + ** views within an underlying model space. This model space is conceived to be two fold: + ** - it is a place or excerpt within the model topology (e.g. the n-th track in the fork) + ** - it has a temporal extension within a larger temporal frame (e.g. some seconds within the timeline) + ** + ** ## rationale + ** + ** TBW + ** + ** ## Interactions + ** + ** - *bla*: connect to blubb + ** see [sigc-track] for an explanation. + ** + ** [MVC-Pattern]: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller + ** [sigc-track]: http://issues.lumiera.org/ticket/940#comment:3 "Ticket #940" + ** + ** @see \ref ZoomWindow_test + ** + */ + + +#ifndef STAGE_MODEL_ZOOM_WINDOW_H +#define STAGE_MODEL_ZOOM_WINDOW_H + + +#include "lib/error.hpp" +//#include "lib/nocopy.hpp" +//#include "lib/idi/entry-id.hpp" +//#include "lib/symbol.hpp" + +//#include +//#include + + +namespace stage { +namespace model { + +// using std::string; +// using lib::Symbol; + + + /** + */ + struct ZoomWindow + { + + ZoomWindow() + { } + + void reset(); + + protected: + + private: + }; + + + + + /** */ + + + + +}} // namespace stage::model +#endif /*STAGE_MODEL_ZOOM_WINDOW_H*/ diff --git a/src/stage/timeline/display-manager.cpp b/src/stage/timeline/display-manager.cpp new file mode 100644 index 000000000..b85572bba --- /dev/null +++ b/src/stage/timeline/display-manager.cpp @@ -0,0 +1,82 @@ +/* + DisplayManager - abstraction to translate model structure and extension into screen layout + + Copyright (C) Lumiera.org + 2018, Hermann Vosseler + + 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 display-manager.cpp + ** Implementation details regarding timeline layout management and widget coordination. + ** + ** @todo WIP-WIP-WIP as of 11/2018 + ** @todo as of 10/2018 timeline display in the UI is rebuilt to match the architecture + ** + */ + + +#include "stage/gtk-base.hpp" +#include "stage/timeline/display-manager.hpp" + +//#include "gui/ui-bus.hpp" +//#include "lib/format-string.hpp" +//#include "lib/format-cout.hpp" + +//#include "lib/util.hpp" + +//#include +//#include + + + +//using util::_Fmt; +//using util::contains; +//using Gtk::Widget; +//using sigc::mem_fun; +//using sigc::ptr_fun; +//using std::cout; +//using std::endl; + + +namespace stage { +namespace timeline { + + + + + DisplayManager::~DisplayManager() { } // emit VTables here.... + + +//DisplayManager::DisplayManager() +// : paneSplitPosition_{topLevelContainer.property_position()} +// , bodyCanvas_{} +// , headerPane_{bodyCanvas_.get_vadjustment()} // wire the header pane (Gtk::Viewport) to follow the body vertical scroll movement +// { +// topLevelContainer.add1 (headerPane_); +// topLevelContainer.add2 (bodyCanvas_); +// } + + + /** + * This function is + */ + + + + +}}// namespace stage::timeline diff --git a/src/stage/timeline/display-manager.hpp b/src/stage/timeline/display-manager.hpp new file mode 100644 index 000000000..957fb5483 --- /dev/null +++ b/src/stage/timeline/display-manager.hpp @@ -0,0 +1,94 @@ +/* + DISPLAY-MANAGER.hpp - abstraction to translate model structure and extension into screen layout + + Copyright (C) Lumiera.org + 2018, Hermann Vosseler + + 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 display-manager.hpp + ** Abstraction: service for the widgets to translate themselves into screen layout. + ** + ** # Architecture + ** + ** We strive to break up the whole process of controlling the layout into several + ** local concerns, each of which can be made self contained. The backbone is formed by + ** a recursive collaboration between two abstractions (interfaces) + ** - the building blocks of the timeline expose the interface timeline::Element + ** - the global timeline widget implements a timeline::LayoutManager interface + ** + ** ## Display evaluation pass + ** + ** Whenever the layout of timeline contents has to be (re)established, we trigger a recursive + ** evaluation pass, which in fact is a tree walk. The layout manager creates a DisplayEvaluation + ** record, which is passed to the [Element's allocate function](\ref Element::allocate). The element + ** in turn has the liability to walk its children and recursively initiate a nested evaluation + ** by invoking DisplayEvaluation::evaluateChild(Element), which in turn calls back to + ** LayoutManager::evaluate() to initiate a recursive evaluation pass. Within the recursively + ** created DisplayEvaluation elements, we are able to transport and aggregate information + ** necessary to give each element it' screen allocation. And this in turn allows us to + ** decide upon a suitable display strategy for each individual element, within a local + ** and self-contained context. + ** + ** @todo WIP-WIP-WIP as of 11/2018 + ** @todo as of 10/2018 timeline display in the UI is rebuilt to match the architecture + ** + */ + + +#ifndef STAGE_TIMELINE_DISPLAY_MANAGER_H +#define STAGE_TIMELINE_DISPLAY_MANAGER_H + + +#include "lib/error.hpp" +#include "lib/nocopy.hpp" + +//#include "lib/util.hpp" + +//#include +//#include + + + +namespace stage { +namespace timeline { + +// class TrackHeadWidget; + + + /** + * Interface used by the widgets to translate themselves into screen layout. + * @todo WIP-WIP as of 11/2018 + */ + class DisplayManager + : util::NonCopyable + { + +// TimelineLayout(); + + public: + virtual ~DisplayManager(); ///< this is an interface + + + private:/* ===== Internals ===== */ + + }; + + +}}// namespace stage::timeline +#endif /*STAGE_TIMELINE_DISPLAY_MANAGER_H*/ diff --git a/src/stage/timeline/timeline-layout.hpp b/src/stage/timeline/timeline-layout.hpp index d0c6bb63c..a070f2fff 100644 --- a/src/stage/timeline/timeline-layout.hpp +++ b/src/stage/timeline/timeline-layout.hpp @@ -83,6 +83,7 @@ #define STAGE_TIMELINE_TIMELINE_LAYOUT_H #include "stage/gtk-base.hpp" +#include "stage/timeline/display-manager.hpp" #include "stage/timeline/header-pane-widget.hpp" #include "stage/timeline/body-canvas-widget.hpp" @@ -107,6 +108,7 @@ namespace timeline { * @todo WIP-WIP as of 10/2018 */ class TimelineLayout + : public DisplayManager { Glib::PropertyProxy paneSplitPosition_; @@ -121,6 +123,8 @@ namespace timeline { /** @internal anchor the display of the root track into the two display panes */ void installRootTrack (TrackHeadWidget&,TrackBody&); + protected:/* ==== Interface: LayoutManager===== */ + private:/* ===== Internals ===== */ }; diff --git a/src/steam/mobject/session/dummy-session-connection.cpp b/src/steam/mobject/session/dummy-session-connection.cpp index 02a5e0c34..1b47fc950 100644 --- a/src/steam/mobject/session/dummy-session-connection.cpp +++ b/src/steam/mobject/session/dummy-session-connection.cpp @@ -111,14 +111,14 @@ namespace session { const RandID forkRootID{stage::ATTR_fork}; const GenNode timeline = emptyTimeline (baseID, forkRootID) , rootTrackName = GenNode{string{stage::ATTR_name}, "Track-"+baseID} - , FORK_ROOT = MakeRec().genNode(forkRootID) + , forkRoot = MakeRec().genNode(forkRootID) ; return MutationMessage{ ins (timeline) , mut (timeline) - , mut (FORK_ROOT) + , mut (forkRoot) , set (rootTrackName) - , emu (FORK_ROOT) + , emu (forkRoot) , emu (timeline) }; } diff --git a/tests/stage/model/zoom-window-test.cpp b/tests/stage/model/zoom-window-test.cpp new file mode 100644 index 000000000..c1a348cc7 --- /dev/null +++ b/tests/stage/model/zoom-window-test.cpp @@ -0,0 +1,93 @@ +/* + ZoomWindow(Test) - verify translation from model to screen coordinates + + Copyright (C) Lumiera.org + 2018, Hermann Vosseler + + 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 zoom-window-test.cpp + ** unit test \ref ZoomWindow_test + */ + + +#include "lib/test/run.hpp" +#include "lib/test/test-helper.hpp" +#include "stage/model/zoom-window.hpp" +//#include "lib/util.hpp" + +//#include +//#include + + +//using util::isSameObject; +//using std::make_unique; +//using std::move; + + +namespace stage{ +namespace model{ +namespace test { + + + namespace { // Test fixture... + +// template +// struct DummyWidget +// : public sigc::trackable +// { +// X val = 1 + rand() % 100; +// }; + } + + + + + /*************************************************************************************//** + * @test verify technicalities regarding the translation between domain model coordinates + * and screen layout coordinates. + * - bla + * - blubb + * @see zoom-window.hpp + */ + class ZoomWindow_test : public Test + { + + virtual void + run (Arg) + { + verify_standardUsage(); + } + + + /** @test the standard use case is to.... TBW + */ + void + verify_standardUsage() + { + } + + + /** @test */ + }; + + + /** Register this test class... */ + LAUNCHER (ZoomWindow_test, "unit gui"); + + +}}} // namespace stage::model::test diff --git a/wiki/renderengine.html b/wiki/renderengine.html index bdb66f463..82a32722e 100644 --- a/wiki/renderengine.html +++ b/wiki/renderengine.html @@ -9078,13 +9078,18 @@ Besides building on the asset management, implementing Timeline (and Sequence) a This topic is {{red{postponed as of 10/2018}}} &rarr; [[#1083|http://issues.lumiera.org/ticket/1083]] -
+
//guide and control the concrete display properties of the various sub components (tracks, clips) comprising a timeline display.//
 
 The TimelineDisplayManager actually is an abstraction, a control interface, revolving around the guidance individual components need in order to settle on a proper display. Those components are represented as mediating entities, the TrackPresenter and the ClipPresenter, each of which controls and manages a mostly passive GTK widget. To this end, the presenters need to know at which virtual coordinates their corresponding widgets would show up, and they need to know if these widgets need to be actually present at the moment. Also, especially the ClipPresenter needs to know which ''clip appearance style'' to choose for the corresponding slave widget.
 
 !display evaluation pass
 [>img[Clip presentation control|uml/Timeline-display-evaluation.png]]Since the timeline display is formed by several nested collections of elements, a proper display layout must incorporate information from all those parts. A naive approach likely would just iterate over them and reach in to extract data -- or even worse, build a separate display data store, which then needs to be kept in sync with the component hierarchy. Any of these naive working styles would lead to high coupling and it turns the necessary adjustment and changes into a liability, which raises due to evolution of requirements. Over time, such a dangerous situation can only be avoided altogether by admitting the collaborative nature of the task at hand. To get there, we need to distil the abstraction shared between the global and the local concerns, and we need to shape it such as to build onto some kind of invariant, allowing that abstraction to re-emerge at several levels of locality.
+
+!translation service for the widgets
+Another, closely related topic, handled within this context, is the translation from model structures and units in to display layout coordinates. Within the model, we can distinguish several dimensions (degrees of freedom). For one, there is the topology, the ''location or part'' of the model to expose through the UI. Moreover, there is the ''degree of detail'' for this UI representation. And then, there is the ''temporal position and extension'' to represent.
+
+By principle, //widgets always work exclusively in pixel coordinates// -- thus we need the help of a coordinating entity to find out where some entity shall be located on the GTK drawing canvas. This becomes especially relevant for the timeline body, since there we're relying on a GuiCustomWidget to perform and control some of the UI drawing by specific custom rules and procedures.
 
diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index c4e6e498e..d93e648cd 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -17901,7 +17901,8 @@ Standard UI-Mechanik überlassen wir GTK

- + + @@ -17917,7 +17918,8 @@ Aus Gründen der Konsistenz und Zukunftsfähigkeit

-
+ + @@ -17929,7 +17931,8 @@ unser InteractionControl ist eine Zwischenschicht

-
+ + @@ -17950,7 +17953,8 @@ - + +
@@ -19089,7 +19093,7 @@ - + @@ -19461,7 +19465,7 @@ - + @@ -21295,8 +21299,8 @@ - + @@ -21325,7 +21329,7 @@ - + @@ -21418,7 +21422,7 @@ - + @@ -21466,7 +21470,7 @@ - +