Clip-Drag: setup access-front-end via dependency injection
Decision to use a dedicated holder service (GestureState), maintained as sub-service within InteractionDirector
This commit is contained in:
parent
451673dd09
commit
65f16d54fa
9 changed files with 222 additions and 16 deletions
|
|
@ -29,7 +29,8 @@
|
|||
** of the UI-Layer and thus, indirectly offers services to provide Icons and other resources, to
|
||||
** open and manage workspace windows, to form and issue (global) actions and to delve into the
|
||||
** UI representation of top-level parts of the session model. And, last but not least, it
|
||||
** exposes the functions to start and stop the GTK event loop.
|
||||
** exposes the functions to start and stop the GTK event loop. However -- most of these
|
||||
** activities are in fact performed and maintained by delegates and sub components.
|
||||
**
|
||||
** The initialisation and shutdown of the framework is handled by the ApplicationBase parent,
|
||||
** while the constituents of the Lumiera UI backbone are allocated as member fields:
|
||||
|
|
|
|||
|
|
@ -40,7 +40,21 @@
|
|||
** Thus, starting from a given model element, it is always possible to "cast" some message towards
|
||||
** the corresponding UI view element, without actually knowing much about that element's implementation.
|
||||
**
|
||||
** @note This header provides the basic definitions for easily accessing relevant UI elements.
|
||||
** @note This header provides the basic definitions for easily accessing relevant UI elements.
|
||||
**
|
||||
** ## The View-Spec DSL
|
||||
**
|
||||
** The goal for the Lumiera UI is not to totally hard-wire the overall structure. Rather, it shall be
|
||||
** possible to "allocate" a view based of rules where to place it within the existing UI structure.
|
||||
** This is especially important, since we expect much editing work to be done in a multi-monitor setup,
|
||||
** where the UI has to span several top-level windows, and allow for location of views in accordance
|
||||
** to the individual editor's habits.
|
||||
**
|
||||
** In the current state (2017/2021) the foundation for such a rule based view allocation was worked out,
|
||||
** but all the possibly quite elaborated details of hooking into the actual widget tree was postponed,
|
||||
** until we have a more mature implementation of actual presentation widgets in place.
|
||||
**
|
||||
** @todo as of 2017 .. 2021, this is a half-finished draft and postponed in favour of building the actually visible timeline display first
|
||||
**
|
||||
** @see interaction-director.hpp
|
||||
** @see ui-bus.hpp
|
||||
|
|
|
|||
|
|
@ -31,8 +31,10 @@
|
|||
|
||||
//#include "lib/util.hpp"
|
||||
//#include "lib/symbol.hpp"
|
||||
#include "lib/depend.hpp"
|
||||
//#include "include/logging.h"
|
||||
#include "stage/interact/cmd-context.hpp"
|
||||
#include "stage/interact/gesture-state.hpp"
|
||||
|
||||
//#include <string>
|
||||
//#include <map>
|
||||
|
|
@ -47,7 +49,7 @@ namespace stage {
|
|||
namespace interact {
|
||||
|
||||
namespace { // internal details
|
||||
|
||||
lib::Depend<GestureState> gestures;
|
||||
} // internal details
|
||||
|
||||
|
||||
|
|
@ -62,6 +64,7 @@ namespace interact {
|
|||
CmdContext&
|
||||
CmdContext::of (Symbol cmdID, string ctxID)
|
||||
{
|
||||
InteractionState& state = gestures().getStateFor (ctxID);
|
||||
UNIMPLEMENTED ("context-bound commands: tap into the InteractionDirector to access the interaction state");
|
||||
}
|
||||
|
||||
|
|
|
|||
62
src/stage/interact/gesture-state.cpp
Normal file
62
src/stage/interact/gesture-state.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
GestureState - holder for interaction-state dedicated to specific gestures
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2021, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
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 gesture-state.cpp
|
||||
** Implementation of a holder and manager for interaction state.
|
||||
**
|
||||
** @todo do we really need a separate implementation unit for this??
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
//#include "lib/util.hpp"
|
||||
//#include "lib/symbol.hpp"
|
||||
//#include "include/logging.h"
|
||||
#include "stage/interact/gesture-state.hpp"
|
||||
|
||||
//#include <string>
|
||||
//#include <map>
|
||||
|
||||
//using std::map;
|
||||
//using std::string;
|
||||
|
||||
//using util::contains;
|
||||
//using util::isnil;
|
||||
|
||||
namespace stage {
|
||||
namespace interact {
|
||||
|
||||
namespace { // internal details
|
||||
|
||||
} // internal details
|
||||
|
||||
|
||||
|
||||
GestureState::~GestureState() { } // TODO really needed?
|
||||
|
||||
|
||||
|
||||
|
||||
/** nonsense */
|
||||
|
||||
}} // namespace stage::interact
|
||||
93
src/stage/interact/gesture-state.hpp
Normal file
93
src/stage/interact/gesture-state.hpp
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
GESTURE-STATE.hpp - holder for interaction-state dedicated to specific gestures
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2015, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
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 gesture-state.hpp
|
||||
** Sub-Service of the InteractionDirector: Hold and maintain InteractionState.
|
||||
** Typically, each distinct gesture or elaborate interaction pattern has a dedicated
|
||||
** InteractionState subclass to maintain the state of ongoing gestures within the UI.
|
||||
** Client code attaches and accesses this state through the CmdContext front-end.
|
||||
** The InteractionDirector exposes a singleton instance of the GestureState manager
|
||||
** through the lib::Depend access framework (Dependency-Injection).
|
||||
**
|
||||
** @todo WIP-WIP as of 3/2021 about to create a prototype implementation for dragging clips...
|
||||
**
|
||||
** @see ////TODO_test usage example
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifndef STAGE_INTERACT_GESTURE_STATE_H
|
||||
#define STAGE_INTERACT_GESTURE_STATE_H
|
||||
|
||||
|
||||
#include "lib/error.hpp"
|
||||
#include "lib/nocopy.hpp"
|
||||
//#include "stage/ctrl/bus-term.hpp"
|
||||
#include "stage/interact/interaction-state.hpp"
|
||||
//#include "lib/idi/entry-id.hpp"
|
||||
#include "lib/symbol.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
//#include <string>
|
||||
|
||||
|
||||
namespace stage {
|
||||
namespace interact {
|
||||
|
||||
// using lib::HashVal;
|
||||
using lib::Symbol;
|
||||
// using util::isnil;
|
||||
// using std::string;
|
||||
|
||||
//class Subject;
|
||||
|
||||
|
||||
/**
|
||||
* Holder for InteractionState dedicated to UI gestures and complex interactions.
|
||||
*
|
||||
* @todo write type comment...
|
||||
* @todo WIP-WIP as of /3/2021
|
||||
* ///////////////////////////////////TODO do we need a translation unit interaction-state.cpp (otherwise delete it!)
|
||||
*/
|
||||
class GestureState
|
||||
: util::NonCopyable
|
||||
{
|
||||
public:
|
||||
~GestureState(); ///////////TODO required??
|
||||
|
||||
public:
|
||||
/**
|
||||
*/
|
||||
InteractionState&
|
||||
getStateFor (std::string ctxID)
|
||||
{
|
||||
UNIMPLEMENTED ("how to designate and access state for specific gestures");
|
||||
}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
}} // namespace stage::interact
|
||||
#endif /*STAGE_INTERACT_GESTURE_STATE_H*/
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
#include "stage/interact/navigator.hpp"
|
||||
#include "stage/interact/focus-tracker.hpp"
|
||||
#include "stage/interact/ui-coord-resolver.hpp"
|
||||
#include "stage/interact/gesture-state.hpp"
|
||||
#include "stage/dialog/preferences-dialog.hpp"
|
||||
#include "stage/dialog/render.hpp"
|
||||
#include "stage/workspace/workspace-window.hpp"
|
||||
|
|
@ -100,6 +101,7 @@ namespace interact {
|
|||
InteractionDirector::InteractionDirector (GlobalCtx& globals)
|
||||
: model::Controller(session::Root::getID(), globals.uiBus_.getAccessPoint())
|
||||
, globalCtx_(globals)
|
||||
, gestureState_{}
|
||||
, viewLocator_{new ViewLocator}
|
||||
, spotLocator_{new SpotLocator}
|
||||
, navigator_{*spotLocator_, *viewLocator_} // Service exposed as Depend<LocationQuery>
|
||||
|
|
@ -246,7 +248,7 @@ namespace interact {
|
|||
void
|
||||
InteractionDirector::render()
|
||||
{
|
||||
dialog::Render dialog(getWorkspaceWindow()); //////global -> InteractionDirector
|
||||
dialog::Render dialog{getWorkspaceWindow()}; //////global -> InteractionDirector
|
||||
dialog.run();
|
||||
|
||||
unimplemented ("start render");
|
||||
|
|
@ -305,7 +307,7 @@ namespace interact {
|
|||
|
||||
namespace {
|
||||
/**
|
||||
* The timeline is actually a front-end to a binding to a root track.
|
||||
* The timeline is actually a front-end for a binding to some root track.
|
||||
* For that reason, we always create the root-track representation alongside
|
||||
* the timeline, and thus we need a very special INS message to create a timeline:
|
||||
* - it must be a record (an "object")
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ namespace interact {
|
|||
class FocusTracker;
|
||||
class ViewLocator;
|
||||
|
||||
class GestureState;
|
||||
|
||||
using timeline::TimelineGui;
|
||||
|
||||
|
||||
|
|
@ -106,11 +108,13 @@ namespace interact {
|
|||
{
|
||||
ctrl::GlobalCtx& globalCtx_;
|
||||
|
||||
// == exposed to Depend on ==
|
||||
// == exposed for Dependency-Incection ==
|
||||
using Service_LocationQuery = lib::DependInject<LocationQuery>::ServiceInstance<Navigator>;
|
||||
using Service_GestureState = lib::DependInject<GestureState>::ServiceInstance<>;
|
||||
|
||||
|
||||
// == global Services ==
|
||||
Service_GestureState gestureState_;
|
||||
unique_ptr<ViewLocator> viewLocator_;
|
||||
unique_ptr<SpotLocator> spotLocator_;
|
||||
Service_LocationQuery navigator_;
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@
|
|||
** As a minimum requirement, each LocationRule should be concluded with such a "catch-all" explicit
|
||||
** create clause, which describes the standard location of the element in question.
|
||||
**
|
||||
** @todo as of 2017 .. 2021, this is a half-finished draft and postponed in favour of building the actually visible timeline display first
|
||||
**
|
||||
** @see UILocationSolver_test
|
||||
** @see ViewSpecDSL_test
|
||||
** @see UICoordResolver
|
||||
|
|
|
|||
|
|
@ -31601,7 +31601,7 @@
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1613349240614" ID="ID_1472064878" MODIFIED="1613349442831" TEXT="erster Entwurf: drag clip">
|
||||
<linktarget COLOR="#fbd7b5" DESTINATION="ID_1472064878" ENDARROW="Default" ENDINCLINATION="-1443;-151;" ID="Arrow_ID_1918638969" SOURCE="ID_1784185766" STARTARROW="None" STARTINCLINATION="1644;332;"/>
|
||||
<linktarget COLOR="#f6b667" DESTINATION="ID_1472064878" ENDARROW="Default" ENDINCLINATION="-9;-115;" ID="Arrow_ID_209732384" SOURCE="ID_1489464895" STARTARROW="None" STARTINCLINATION="220;19;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1613349479473" ID="ID_1618505083" MODIFIED="1613349488782" TEXT="Doku / Tutorials">
|
||||
<node CREATED="1613349541627" ID="ID_1745870905" MODIFIED="1613349560713" TEXT="man muß das motion_notify_event beobachten">
|
||||
<icon BUILTIN="idea"/>
|
||||
|
|
@ -31629,7 +31629,7 @@
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1614379765040" ID="ID_1624270915" MODIFIED="1614380579512" TEXT="neuer Anlauf für Kontext-bezogene Commands">
|
||||
<arrowlink COLOR="#5b4964" DESTINATION="ID_1221036425" ENDARROW="Default" ENDINCLINATION="717;-46;" ID="Arrow_ID_1875882072" STARTARROW="None" STARTINCLINATION="586;34;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1614380675501" ID="ID_163523275" MODIFIED="1614380716283" TEXT="Leitfrage: was muß ich jetzt konkret anlegen, damit »drag Clip« in dieses Schema paßt?">
|
||||
<icon BUILTIN="help"/>
|
||||
</node>
|
||||
|
|
@ -31690,8 +31690,8 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1614391106909" ID="ID_829290263" MODIFIED="1614391113925" TEXT="Ausarbeitung dieser Lösung">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1614391106909" ID="ID_829290263" MODIFIED="1616859849980" TEXT="Ausarbeitung dieser Lösung">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1614391126643" ID="ID_339143488" MODIFIED="1614391152827" TEXT="Grundlage">
|
||||
<node CREATED="1614391153839" ID="ID_1357502282" MODIFIED="1614391168548" TEXT="CmdContext ist ein Metasprache-Interface">
|
||||
<icon BUILTIN="yes"/>
|
||||
|
|
@ -31835,8 +31835,8 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1614543493162" ID="ID_1473378249" MODIFIED="1614543505465" TEXT="mit der bestehenden Implementierung verbinden">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1614543493162" ID="ID_1473378249" MODIFIED="1616859840596" TEXT="mit der bestehenden Implementierung verbinden">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1614543561632" ID="ID_1754386766" MODIFIED="1614543810211" TEXT="diverse Widersprüche und Spannungen">
|
||||
<linktarget COLOR="#f45679" DESTINATION="ID_1754386766" ENDARROW="Default" ENDINCLINATION="93;-23;" ID="Arrow_ID_367937676" SOURCE="ID_1302795590" STARTARROW="None" STARTINCLINATION="-164;8;"/>
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
|
|
@ -32128,7 +32128,7 @@
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1615563740336" ID="ID_1714668959" MODIFIED="1615563782709" TEXT="Lösungs-Skizze für Clip-Drag erstellen">
|
||||
<linktarget COLOR="#3363bf" DESTINATION="ID_1714668959" ENDARROW="Default" ENDINCLINATION="36;-129;" ID="Arrow_ID_794903503" SOURCE="ID_1223828386" STARTARROW="None" STARTINCLINATION="-320;18;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1616684903452" ID="ID_1953335093" MODIFIED="1616684964824">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
|
@ -32327,11 +32327,32 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1616852178983" ID="ID_389047439" MODIFIED="1616852207108" TEXT="Strukturen gemäß Konzept anlegen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1616852190829" ID="ID_1663212368" MODIFIED="1616852206157" TEXT="CmdContext">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1616852178983" ID="ID_389047439" MODIFIED="1616859822702" TEXT="Strukturen gemäß Konzept anlegen">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1616852190829" ID="ID_1663212368" MODIFIED="1616859815753" TEXT="CmdContext">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1616859779196" ID="ID_848065191" MODIFIED="1616859786984" TEXT="Dependency-Injection nutzen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1616859787843" ID="ID_1635546920" MODIFIED="1616859809178" TEXT="Klären: wie wird die CtxID aufgelöst?">
|
||||
<icon BUILTIN="help"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1616854202348" ID="ID_340156587" MODIFIED="1616854226249" TEXT="Auswahl und Zugriff auf den passenden InteractionState">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1616856060491" ID="ID_44406517" MODIFIED="1616859101168" TEXT="einen Manager für den InteractionState schaffen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1616859073891" ID="ID_909388621" MODIFIED="1616859108655" TEXT="Name: GestureState">
|
||||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1616859080858" ID="ID_1168738584" MODIFIED="1616859110568" TEXT="angesiedelt im InteractionDirector">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1616859087201" ID="ID_1804482999" MODIFIED="1616859111916" TEXT="zugänglich via lib::Depend<GestureState>">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1616852275162" ID="ID_1272601084" MODIFIED="1616852283276" TEXT="DragRelocateController verwalten">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
|
|
@ -37142,6 +37163,10 @@
|
|||
<linktarget COLOR="#6b709e" DESTINATION="ID_131071232" ENDARROW="Default" ENDINCLINATION="275;0;" ID="Arrow_ID_1369499964" SOURCE="ID_130562988" STARTARROW="Default" STARTINCLINATION="275;0;"/>
|
||||
<icon BUILTIN="help"/>
|
||||
</node>
|
||||
<node COLOR="#3301ae" CREATED="1616854028288" ID="ID_1575859119" MODIFIED="1616854070566" TEXT="neige mehr und mehr dazu, dies rein intern in gewissen »Gesten-Controllern« zu regeln...">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1488674268407" ID="ID_284516869" MODIFIED="1518487921092" TEXT="Parameter">
|
||||
|
|
|
|||
Loading…
Reference in a new issue