DummySessionConnection: produce a simple population diff message

seems to work surprisingly well...
the diff application poceeds in the GUI up to the point
where the TrackPresenter need to be inserted into a two-fold display context
This commit is contained in:
Fischlurch 2018-10-15 00:54:10 +02:00
parent de5f0b85d4
commit 572bd38fec
5 changed files with 66 additions and 12 deletions

View file

@ -39,9 +39,12 @@
//#include "lib/symbol.hpp"
//#include "include/logging.h"
#include "proc/mobject/session/dummy-session-connection.hpp"
#include "proc/mobject/session/root.hpp"
#include "proc/control/command-def.hpp"
#include "include/ui-protocol.hpp"
#include "include/gui-notification-facade.h"
#include "lib/diff/tree-diff-application.hpp"
#include "lib/diff/mutation-message.hpp"
#include "lib/diff/gen-node.hpp"
//#include "lib/idi/entry-id.hpp"
#include "lib/format-string.hpp"
@ -53,6 +56,8 @@
//#include <map>
using lib::diff::GenNode;
using lib::diff::MakeRec;
using lib::diff::MutationMessage;
//using util::cStr;
using util::_Fmt;
using std::string;
@ -71,6 +76,16 @@ namespace session {
namespace { //Implementation details....
GenNode
emptyTimeline (string baseID)
{
return MakeRec()
.set(string{gui::ATTR_fork}
,MakeRec()
.type(string{gui::TYPE_Fork})
)
.genNode(baseID);
}
} //(End)Implementation details....
@ -86,10 +101,21 @@ namespace session {
/**
*
* @param id
* @return
* Build a population diff message to describe a specific session structure to add
*/
MutationMessage
DummySessionConnection::fabricateSeq1 (string baseID)
{
return MutationMessage{ ins (emptyTimeline (baseID))
};
}
void
DummySessionConnection::applyCopy (MutationMessage const& diff)
{
TODO ("build internal diagnostic data structure, apply a copy of the message");
}
}}// namespace proc::mobject::session
@ -105,6 +131,10 @@ namespace cmd {
// using gui::MARK_expand;
using gui::GuiNotification;
// using util::isYes;
namespace session = proc::mobject::session;
using DummySess = session::DummySessionConnection;
/* ============ dedicated Fake-Commands ============ */
@ -124,6 +154,10 @@ COMMAND_DEFINITION (test_fake_injectSequence_1)
{
string message{_Fmt{"fabricate Sequence_1 (dummyID='%s')"} % dummyID};
GuiNotification::facade().displayInfo (NOTE_INFO, message);
auto popuDiff = DummySess::instance().fabricateSeq1 (dummyID);
DummySess::instance().applyCopy (popuDiff);
auto rootID = session::Root::getID();
GuiNotification::facade().mutate (rootID, move(popuDiff));
})
.captureUndo ([](string dummyID) -> string
{

View file

@ -48,10 +48,15 @@
#include "lib/nocopy.hpp"
#include "lib/util.hpp"
#include "lib/diff/tree-diff.hpp"
#include "proc/control/command-setup.hpp"
#include <string>
namespace lib {
namespace diff{
class MutationMessage;
}}
namespace proc {
namespace cmd {
@ -70,6 +75,7 @@ namespace session {
//using util::isnil;
using std::string;
using lib::diff::MutationMessage;
/**
* Scaffolding to drive the evolution of the Lumiera application.
@ -83,7 +89,8 @@ namespace session {
* @see gui::timeline::TimelineController
*/
class DummySessionConnection
: util::NonCopyable
: lib::diff::TreeDiffLanguage
, util::NonCopyable
{
string nothing_;
@ -102,6 +109,11 @@ namespace session {
/* == do X == */
/* == forget Y == */
MutationMessage fabricateSeq1 (string baseID);
void applyCopy (MutationMessage const&);
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1042
void setSolution (string const& solution = "")

View file

@ -641,8 +641,10 @@ namespace test {
* For this to work, the receiver needs to create a custom _diff binding_.
* Thus, each subclass of Tangible has to implement the virtual function
* Tangible::buildMutator() and hook up those internal structures, which
* are exposed to changes via diff message. Note especially how child
* UI elements are added this way, to populate the contents of the UI.
* are exposed to changes via diff message. This is what we then call a
* "diff binding" (and MockElement is already outfitted this way). Note
* especially how child UI elements can be added recursively, allowing
* gradually to populate the contents of the UI.
*
* The diff itself is an iterable sequence of _diff verbs_.
* Typically, such a diff is generated as the result of some operation

View file

@ -1,5 +1,5 @@
/*
MutationMessage(Test) - demonstrate the basics of tree diff representation
MutationMessage(Test) - verify diff mutation message container
Copyright (C) Lumiera.org
2017, Hermann Vosseler <Ichthyostega@web.de>

View file

@ -5254,10 +5254,16 @@
<node CREATED="1539525949443" ID="ID_1576521954" MODIFIED="1539525960551" STYLE="fork" TEXT="einfacher Standardfall">
<icon BUILTIN="info"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539554145649" ID="ID_1360223401" MODIFIED="1539554160367" TEXT="Diff anlegen">
<node COLOR="#338800" CREATED="1539554145649" ID="ID_1360223401" MODIFIED="1539564554201" TEXT="Diff anlegen">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1539564584429" ID="ID_1716609826" MODIFIED="1539564587445" TEXT="Root-Track">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539564589548" ID="ID_1561391207" MODIFIED="1539564596852" TEXT="zwei Clips darin">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539525933590" ID="ID_1481796996" MODIFIED="1539525937141" TEXT="Sequence-2">
<icon BUILTIN="flag-yellow"/>
<node CREATED="1539525938045" ID="ID_940685408" MODIFIED="1539525947722" TEXT="komplex geschachtelt">
@ -5267,11 +5273,11 @@
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539525972400" ID="ID_1975832820" MODIFIED="1539525980128" TEXT="Testdaten-Verwaltung">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539525981879" ID="ID_1137936334" MODIFIED="1539527181544" TEXT="DummySessionConnection etablieren #1042">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1539525981879" ID="ID_1137936334" MODIFIED="1539564569271" TEXT="DummySessionConnection etablieren #1042">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539525998157" ID="ID_1482744929" MODIFIED="1539526033216" TEXT="Diff-tee">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1539525998157" ID="ID_1482744929" MODIFIED="1539564563690" TEXT="Diff-tee">
<icon BUILTIN="flag-pink"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539526035136" ID="ID_1859459942" MODIFIED="1539526051278" TEXT="Daten-Dump">
<icon BUILTIN="flag-yellow"/>