Timeline: define representation of the profile verb tokens

This commit is contained in:
Fischlurch 2019-04-06 19:34:19 +02:00
parent df02258547
commit e85f218045
5 changed files with 80 additions and 19 deletions

View file

@ -81,8 +81,10 @@ namespace lib {
template<class REC, class RET, typename... ARGS>
class VerbToken<REC, RET(ARGS...)>
{
public:
typedef RET (REC::*Handler) (ARGS...);
private:
Handler handler_;
Literal token_;

View file

@ -58,10 +58,11 @@
#define STAGE_TIMELINE_BODY_CANVAS_WIDGET_H
#include "stage/gtk-base.hpp"
#include "stage/timeline/track-profile.hpp"
//#include "lib/util.hpp"
#include <memory>
//#include <memory>
//#include <vector>
@ -69,18 +70,15 @@
namespace stage {
namespace timeline {
class TrackProfile;
class TrackBody;
class TimelineCanvas
: public Gtk::Layout
{
using TProfile = std::unique_ptr<TrackProfile>;
public:
TrackBody* rootBody_;
TProfile profile_;
TrackProfile profile_;
TimelineCanvas();

View file

@ -41,7 +41,6 @@
#define STAGE_TIMELINE_TRACK_BODY_H
#include "stage/gtk-base.hpp"
#include "stage/timeline/track-profile.hpp"
#include "stage/timeline/ruler-track.hpp"
//#include "lib/util.hpp"

View file

@ -41,7 +41,8 @@
#include "stage/gtk-base.hpp"
#include "lib/verb-token.hpp"
//#include "lib/util.hpp"
#include "lib/symbol.hpp"
#include "lib/util.hpp"
//#include <memory>
#include <vector>
@ -51,6 +52,21 @@
namespace stage {
namespace timeline {
using lib::Literal;
class ProfileInterpreter
{
public:
~ProfileInterpreter() { } ///< this is an interface
virtual void ruler(uint h) =0; ///< represent a overview/ruler track with the given height
virtual void gap(uint h) =0; ///< represent a gap to structure the display
virtual void content(uint h) =0; ///< represent a content area with the given vertical extension
virtual void open(uint n) =0; ///< indicate entering a nested structure, typically as 3D inset (`n` is always 1)
virtual void close(uint n) =0; ///< indicate the end of `n` nested structures, typically by ascending back `n` levels
virtual void prelude(uint f) =0; ///< start rack presentation at top of the timeline, with `f` pinned (always visible) elements
virtual void coda(uint pad) =0; ///< the closing part of the timeline at the bottom of the track display, with `pad` additional padding
};
/**
* Description of the structure and arrangement of tracks for display in the UI.
@ -61,13 +77,44 @@ namespace timeline {
* we let the individual TrackBody elements just emit these structure description.
* @todo WIP-WIP as of 4/2019
*/
class TrackProfile
struct TrackProfile
{
using SlopeVerb = lib::VerbToken<ProfileInterpreter, void(uint)>;
using SlopeElm = std::tuple<SlopeVerb, uint>;
using Elements = std::vector<SlopeElm>;
Elements elements;
// default constructible, standard copy operations
explicit
operator bool() const
{
return not util::isnil (elements);
}
private:/* ===== Internals: handling tokens ===== */
void
append (SlopeVerb::Handler handler, Literal token, uint param)
{
elements.emplace_back (SlopeVerb{handler, token}, param);
}
#define TOKEN_BUILDER(_TOK_) \
void \
append_ ## _TOK_ (uint param)\
{ \
this->append (&ProfileInterpreter::_TOK_, STRINGIFY(_TOK_), param);\
}
public:
private:/* ===== Internals ===== */
TOKEN_BUILDER (ruler)
TOKEN_BUILDER (gap)
TOKEN_BUILDER (content)
TOKEN_BUILDER (open)
TOKEN_BUILDER (close)
TOKEN_BUILDER (prelude)
TOKEN_BUILDER (coda)
};

View file

@ -19693,12 +19693,22 @@
</node>
</node>
</node>
<node CREATED="1554516243633" ID="ID_386714682" MODIFIED="1554516245860" TEXT="Verben">
<node CREATED="1554516247416" ID="ID_711078188" MODIFIED="1554516251040" TEXT="ruler"/>
<node CREATED="1554516251688" ID="ID_24688004" MODIFIED="1554516256283" TEXT="gap"/>
<node CREATED="1554516257065" ID="ID_389097560" MODIFIED="1554516261186" TEXT="content"/>
<node CREATED="1554516438055" ID="ID_1490793853" MODIFIED="1554516446110" TEXT="open / close"/>
<node CREATED="1554567321239" FOLDED="true" ID="ID_1638157583" MODIFIED="1554567367842" TEXT="prelude / coda">
<node COLOR="#435e98" CREATED="1554516243633" ID="ID_386714682" MODIFIED="1554572013861" TEXT="Verben">
<icon BUILTIN="info"/>
<node COLOR="#338800" CREATED="1554516247416" ID="ID_711078188" MODIFIED="1554571978972" TEXT="ruler">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1554516251688" ID="ID_24688004" MODIFIED="1554571980569" TEXT="gap">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1554516257065" ID="ID_389097560" MODIFIED="1554571981566" TEXT="content">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1554516438055" ID="ID_1490793853" MODIFIED="1554571982521" TEXT="open / close">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1554567321239" FOLDED="true" ID="ID_1638157583" MODIFIED="1554571983835" TEXT="prelude / coda">
<icon BUILTIN="button_ok"/>
<node CREATED="1554567338981" ID="ID_1124816442" MODIFIED="1554567365787" TEXT="damit der Display-Code da was Spezielles machen kann..."/>
</node>
</node>
@ -19728,8 +19738,13 @@
<node CREATED="1554516850759" ID="ID_361309913" MODIFIED="1554516863201" TEXT="content mu&#xdf; mit ausreichend Padding platziert werden"/>
</node>
</node>
<node CREATED="1554516928332" ID="ID_874621550" MODIFIED="1554516935111" TEXT="Verben definieren"/>
<node CREATED="1554516938851" ID="ID_1733864099" MODIFIED="1554516951053" TEXT="Verb-Sequenz speichern"/>
<node COLOR="#338800" CREATED="1554516928332" ID="ID_874621550" MODIFIED="1554571988618" TEXT="Verben definieren">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1554571992025" ID="ID_1074099376" MODIFIED="1554571997418" TEXT="Anwendung der Verben"/>
<node COLOR="#338800" CREATED="1554516938851" ID="ID_1733864099" MODIFIED="1554571998473" TEXT="Verb-Sequenz speichern">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1554516951713" ID="ID_318462518" MODIFIED="1554516961692" TEXT="Verben (rekursiv) generieren">
<node CREATED="1554516977204" ID="ID_305770947" MODIFIED="1554516978849" TEXT="Ruler"/>
<node CREATED="1554516979454" ID="ID_508239889" MODIFIED="1554516983920" TEXT="Gaps handhaben"/>