Timeline: actually accept and install the TimelineWidget

As starting point, provide an empty placeholder widget to fill the void
This commit is contained in:
Fischlurch 2018-10-13 23:58:49 +02:00
parent 6e18452c37
commit 67cccbdc5d
9 changed files with 125 additions and 173 deletions

View file

@ -36,31 +36,13 @@
#include "gui/timeline/timeline-widget.hpp"
#include "gui/timeline/timeline-widget-empty.hpp"
//#include "gui/workspace/workspace-window.hpp"
//#include "gui/ui-bus.hpp"
//#include "lib/format-string.hpp"
//#include "lib/format-cout.hpp"
//#include "lib/util.hpp"
//#include <algorithm>
//#include <cstdlib>
//#include <string>
//using util::_Fmt;
//using std::shared_ptr;
using std::make_unique;
//using util::contains;
//using Gtk::Widget;
//using sigc::mem_fun;
//using sigc::ptr_fun;
//using std::string;
namespace gui {
namespace panel {
using timeline::TimelinePage;
using timeline::TimelineWidget;
using timeline::TimelineWidgetEmpty;
@ -71,7 +53,7 @@ namespace panel {
, tabs_{}
, pages_{}
{
pages_.emplace_back (new TimelineWidgetEmpty{});
addTimeline (PageHandle{new TimelineWidgetEmpty{}});
// show everything....
this->add(tabs_);
@ -91,11 +73,26 @@ namespace panel {
}
namespace {
bool
isEmptyTimeline (auto& pages)
{
return 1 == pages.size()
and dynamic_cast<TimelineWidgetEmpty*> (pages[0].get());
}
}
void
TimelinePanel::addTimeline (PageHandle&& pTimelineWidget)
{
UNIMPLEMENTED ("take ownership of the widget and place it into a new tab");
if (isEmptyTimeline (pages_))
{
tabs_.remove_page();
pages_.clear();
}
pages_.push_back (move (pTimelineWidget));
TimelinePage& addedPage = *pages_.back();
tabs_.append_page (addedPage, addedPage.getLabel());
}

View file

@ -24,16 +24,14 @@
/** @file timeline-panel.hpp
** A dockable container to hold a notebook of timeline displays.
**
** ## planned design 2/2017
** The architecture of the UI is in a state of transition right now, working towards the goal
** of interconnected layers and an operative session and engine. Within the new control structure
** about to be built, there is an UI top-level circle of managing entities to handle global concerns
** and actions. The ctrl::InteractionDirector incorporates the role of _model root_ and thus manages
** a collection of timelines. The timeline panel exposes this collection and allows to view and
** interact with one of the given timelines. The build-up of the timeline display and thus the
** initiative to expose a timeline comes from the interaction director -- but as usual with
** graphical user interfaces, any user interaction after this point is handled autonomously
** by the gui::timeline::TimelineWidget and gui::timeline::TimelineController
** ## Management of Timeline display
** Within the Lumiera GTK UI, there is an UI top-level circle of managing entities to handle global
** concerns and actions. The ctrl::InteractionDirector incorporates the role of _model root_ and thus
** manages a collection of timelines. The timeline panel exposes this collection and allows to view and
** interact with one of the given timelines. The build-up of the timeline display and thus the initiative
** to expose a timeline comes from the interaction director -- but as usual with graphical user interfaces,
** any user interaction after this point is handled autonomously by the gui::timeline::TimelineWidget and
** gui::timeline::TimelineController
**
** @todo as of 10/2016 this is WIP-WIP-WIP : canvas widgets experiment
** @todo as of 10/2018 we start to build a new timeline widget, connected to the UI-Bus
@ -80,7 +78,7 @@ namespace panel{
static const char* getTitle();
static const gchar* getStockID();
/////////////////////////////////////////////////////////////TODO WIP
/** take ownership of the widget and place it into a new tab */
void addTimeline (PageHandle &&);
private:

View file

@ -99,7 +99,7 @@ namespace timeline {
*/
TimelineController (ID identity, ID trackID, ctrl::BusTerm& nexus);
~TimelineController();
~TimelineController();
/** set up a binding to respond to mutation messages via UiBus */
@ -108,6 +108,12 @@ namespace timeline {
public: /* ===== Control interface ===== */
string const&
getName() const
{
return name_;
}
public: /* ===== Signals ===== */
private:/* ===== Events ===== */

View file

@ -58,7 +58,7 @@ namespace timeline {
{ }
/**
* @remark basically the default, just defined here explicitly
* @remark basically the default copy ctor, just redefined here explicitly
* to allow using TimelineGui without the need to include timeline-widget.hpp
*/
TimelineGui::TimelineGui (TimelineGui const& r)

View file

@ -1,80 +0,0 @@
/*
TimelineWidgetEmpty - placeholder widget for a missing timeline
Copyright (C) Lumiera.org
2016, 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 timeline-widget-empty.cpp
** Implementation of an empty timeline placeholder.
**
** @todo as of 12/2016 a complete rework of the timeline display is underway
**
*/
#include "gui/gtk-base.hpp"
#include "gui/timeline/timeline-widget-empty.hpp"
//#include "gui/workspace/workspace-window.hpp"
//#include "gui/ui-bus.hpp"
//#include "lib/format-string.hpp"
//#include "lib/format-cout.hpp"
//#include "lib/util.hpp"
//#include <algorithm>
//#include <cstdlib>
//using util::_Fmt;
//using std::shared_ptr;
//using std::weak_ptr;
//using util::contains;
//using Gtk::Widget;
//using sigc::mem_fun;
//using sigc::ptr_fun;
//using std::cout;
//using std::endl;
namespace gui {
namespace timeline {
//const int TimelineWidget::TrackPadding = 1;
//const int TimelineWidget::HeaderWidth = 150;
//const int TimelineWidget::HeaderIndentWidth = 10;
TimelineWidgetEmpty::TimelineWidgetEmpty ()
{
}
TimelineWidgetEmpty::~TimelineWidgetEmpty()
{
}
}}// namespace gui::timeline

View file

@ -23,12 +23,12 @@
/** @file timeline-widget-empty.hpp
** Empty placeholder to be rendered when the UI starts without session.
** The TimelinePannel represents the [model root](\ref mobject::session::Root) and thus
** has the responsibility to manage the individual TimelineWidget instances. In case the
** UI is started with no usable session loaded in Proc-Layer, this empty placeholder widget
** can be inserted.
**
** @todo as of 12/2016 a complete rework of the timeline display is underway
** A TimelinePannel is able to expose several timelines in a tabbed notebook.
** However, the actual [model root](\ref mobject::session::Root) is represented by the
** InteractionDirector, which receives the timeline contents pushed up from the session
** as diff messages and injects a TimelineWidget for each of them. But when not timeline
** is present and thus no actual TimelineWidget was yet instantiated, the TimelinePanel
** will install this TimelineWidgetEmpty placeholder instead to fill the void.
**
*/
@ -37,13 +37,7 @@
#define GUI_TIMELINE_TIMELINE_WIDGET_EMPTY_H
#include "gui/gtk-base.hpp"
#include "gui/timeline/timeline-widget.hpp"
#include "lib/time/timevalue.hpp"
//#include <memory>
//#include <vector>
namespace gui {
@ -51,32 +45,52 @@ namespace timeline {
/**
* Core timeline display (custom widget).
* @todo WIP-WIP-rewrite as of 12/2016
* @remarks At top level, this widget is split into a header pane (left)
* and a scrollable timeline body (right). The layout of both parts is aligned.
* Placeholder to show when no actual Timeline is present.
* Typically this happens when the application starts up and no session has been loaded (yet).
* @todo This widget could offer a list of last sessions to pick from etc...
* @remarks We just display some quote to fill the void...
*/
class TimelineWidgetEmpty
: public TimelinePage
{
Gtk::Frame frame_;
Gtk::Box content_;
Gtk::Label messageText_;
Gtk::Label quoteText_;
Gtk::Image image_;
cuString
getLabel() const override
{
return _("[virgin]");
}
public:
/**
* @param source_state state to be used used as the
* data source (model) for this timeline widget.
*/
TimelineWidgetEmpty();
~TimelineWidgetEmpty();
public: /* ===== Control interface ===== */
public: /* ===== Signals ===== */
private:/* ===== Events ===== */
private:/* ===== Internals ===== */
TimelineWidgetEmpty()
: TimelinePage{}
, content_{Gtk::ORIENTATION_VERTICAL}
, image_{Gtk::StockID{"track_enabled"}, Gtk::ICON_SIZE_LARGE_TOOLBAR}
{
messageText_.set_markup("To be or not to be that is the question...");
messageText_.set_max_width_chars(80);
messageText_.set_line_wrap();
messageText_.set_halign(Gtk::ALIGN_FILL);
messageText_.set_valign(Gtk::ALIGN_FILL);
quoteText_.set_markup ("<i>-- the great actor Joseph Tura</i>");
quoteText_.set_halign(Gtk::ALIGN_END);
quoteText_.set_valign(Gtk::ALIGN_START);
content_.pack_start (messageText_, Gtk::PACK_SHRINK);
content_.pack_start (quoteText_, Gtk::PACK_EXPAND_PADDING);
frame_.add(content_);
frame_.set_border_width(5);
frame_.set_halign(Gtk::ALIGN_END);
frame_.set_valign(Gtk::ALIGN_START);
Gtk::Paned::add1 (image_);
Gtk::Paned::add2 (frame_);
}
};

View file

@ -83,5 +83,13 @@ namespace timeline {
}
cuString
TimelineWidget::getLabel() const
{
control_->getName();
}
}}// namespace gui::timeline

View file

@ -85,10 +85,13 @@ namespace timeline {
: public Gtk::Paned
{
public:
virtual ~TimelinePage() { } ///< this is an interface
virtual ~TimelinePage() { } ///< this is an interface
virtual cuString getLabel() const =0;
TimelinePage()
: Gtk::Paned{Gtk::ORIENTATION_VERTICAL}
: Gtk::Paned{Gtk::ORIENTATION_HORIZONTAL}
{ }
};
@ -136,6 +139,9 @@ namespace timeline {
/** allow for diff mutation (delegated to TimelineController */
void buildMutator (lib::diff::TreeMutator::Handle);
cuString getLabel() const override;
public: /* ===== Signals ===== */
private:/* ===== Events ===== */

View file

@ -5243,18 +5243,18 @@
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538940061190" ID="ID_1231562526" MODIFIED="1538942179606" TEXT="Timeline Panel bauen">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538940061190" ID="ID_1231562526" MODIFIED="1539480803247" TEXT="Timeline Panel bauen">
<arrowlink COLOR="#fec680" DESTINATION="ID_712786561" ENDARROW="Default" ENDINCLINATION="-1077;-98;" ID="Arrow_ID_433721169" STARTARROW="None" STARTINCLINATION="860;206;"/>
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538940061190" ID="ID_1375216048" MODIFIED="1539141015314" TEXT="verankern im InteractonDirector">
<arrowlink COLOR="#fec680" DESTINATION="ID_810032444" ENDARROW="Default" ENDINCLINATION="-451;-531;" ID="Arrow_ID_1378803021" STARTARROW="None" STARTINCLINATION="335;22;"/>
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1538940061190" ID="ID_1375216048" MODIFIED="1539480786412" TEXT="verankern im InteractonDirector">
<arrowlink COLOR="#fec680" DESTINATION="ID_810032444" ENDARROW="Default" ENDINCLINATION="-451;-531;" ID="Arrow_ID_1378803021" STARTARROW="None" STARTINCLINATION="335;22;"/>
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538941158698" ID="ID_513093052" MODIFIED="1538941168250" TEXT="vorl&#xe4;ufiger Allokator">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1538941158698" ID="ID_513093052" MODIFIED="1539480793247" TEXT="vorl&#xe4;ufiger Allokator">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538941253181" ID="ID_1144811315" MODIFIED="1538941261333" TEXT="multi-Tab-Anzeige">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1538941253181" ID="ID_1144811315" MODIFIED="1539480797114" TEXT="multi-Tab-Anzeige">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538940061190" ID="ID_1325225528" MODIFIED="1538942777237" TEXT="Aktion re-Locate">
<arrowlink COLOR="#fec680" DESTINATION="ID_1992201258" ENDARROW="Default" ENDINCLINATION="-784;-81;" ID="Arrow_ID_126634995" STARTARROW="None" STARTINCLINATION="651;0;"/>
@ -16501,8 +16501,8 @@
<node CREATED="1539394478891" ID="ID_1478223120" MODIFIED="1539394482926" TEXT="analog zum Error-Log"/>
<node CREATED="1539394483610" ID="ID_847301374" MODIFIED="1539394505931" TEXT="vorl&#xe4;ufig: WindowLocator -&gt; PanelLoactor"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539141076630" ID="ID_399959646" MODIFIED="1539394533967" TEXT="Auspr&#xe4;gung / Platzierung festlegen">
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1539141076630" ID="ID_399959646" MODIFIED="1539480759403" TEXT="Auspr&#xe4;gung / Platzierung festlegen">
<icon BUILTIN="button_ok"/>
<node CREATED="1539388923323" ID="ID_585499856" MODIFIED="1539389164184" TEXT="Frage: wann wird eine Timeline im GUI repr&#xe4;sentiert?">
<arrowlink COLOR="#c8a1fe" DESTINATION="ID_430199880" ENDARROW="Default" ENDINCLINATION="-629;0;" ID="Arrow_ID_1293894659" STARTARROW="None" STARTINCLINATION="-505;56;"/>
<node CREATED="1539389169498" ID="ID_1287197830" MODIFIED="1539389171373" TEXT="immer?"/>
@ -16517,19 +16517,19 @@
<node CREATED="1539389434086" ID="ID_1428746299" MODIFIED="1539389441601" TEXT="mu&#xdf; das Widget zerst&#xf6;ren"/>
<node CREATED="1539389442477" ID="ID_803437655" MODIFIED="1539389449704" TEXT="TimelineGui wird inaktiv"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539394521229" ID="ID_1457306650" MODIFIED="1539394699315" TEXT="den Rest &#xfc;berlassen wir dem TimelinePanel">
<node COLOR="#338800" CREATED="1539394521229" ID="ID_1457306650" MODIFIED="1539480750133" TEXT="den Rest &#xfc;berlassen wir dem TimelinePanel">
<arrowlink COLOR="#6bb2d4" DESTINATION="ID_50363803" ENDARROW="Default" ENDINCLINATION="381;11;" ID="Arrow_ID_1031630897" STARTARROW="None" STARTINCLINATION="-27;76;"/>
<icon BUILTIN="flag-yellow"/>
<icon BUILTIN="button_ok"/>
</node>
</node>
</node>
<node COLOR="#338800" CREATED="1539141131742" ID="ID_1557130599" MODIFIED="1539394616681" TEXT="WLink baut TimelineWidget und verdrahtet Controller">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539141115961" ID="ID_50363803" MODIFIED="1539394795397" TEXT="TimelineWidget installieren">
<node COLOR="#338800" CREATED="1539141115961" ID="ID_50363803" MODIFIED="1539480747523" TEXT="TimelineWidget installieren">
<arrowlink COLOR="#a678c8" DESTINATION="ID_1510868551" ENDARROW="Default" ENDINCLINATION="-587;-51;" ID="Arrow_ID_206932394" STARTARROW="None" STARTINCLINATION="-699;0;"/>
<linktarget COLOR="#6bb2d4" DESTINATION="ID_50363803" ENDARROW="Default" ENDINCLINATION="381;11;" ID="Arrow_ID_1031630897" SOURCE="ID_1457306650" STARTARROW="None" STARTINCLINATION="-27;76;"/>
<icon BUILTIN="flag-yellow"/>
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#990000" CREATED="1539141189855" ID="ID_1121710933" MODIFIED="1539262827297" TEXT="Achtung: GUI lebt woanders...">
<arrowlink COLOR="#732647" DESTINATION="ID_385121370" ENDARROW="Default" ENDINCLINATION="93;-27;" ID="Arrow_ID_384022851" STARTARROW="None" STARTINCLINATION="-2;36;"/>
@ -19050,29 +19050,32 @@
</node>
<node CREATED="1538941704952" HGAP="12" ID="ID_429142366" MODIFIED="1538941723212" TEXT="konkrete Panels" VSHIFT="26">
<icon BUILTIN="hourglass"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1480694550601" ID="ID_712786561" MODIFIED="1538942194204" TEXT="Timeline-Panel">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1480694550601" ID="ID_712786561" MODIFIED="1539480735537" TEXT="Timeline-Panel">
<linktarget COLOR="#fec680" DESTINATION="ID_712786561" ENDARROW="Default" ENDINCLINATION="-1077;-98;" ID="Arrow_ID_433721169" SOURCE="ID_1231562526" STARTARROW="None" STARTINCLINATION="860;206;"/>
<icon BUILTIN="flag-yellow"/>
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1539394757429" ID="ID_376064530" MODIFIED="1539459391069" TEXT="wegr&#xe4;umen des Testcodes">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539394765628" ID="ID_308731527" MODIFIED="1539394778891" TEXT="Widget-Struktur anlegen">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1539394765628" ID="ID_308731527" MODIFIED="1539480707741" TEXT="Widget-Struktur anlegen">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1539459412979" ID="ID_1273129379" MODIFIED="1539459441106" TEXT="leere Platzhalter-Timeline">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539459428928" ID="ID_1156538064" MODIFIED="1539459436200" TEXT="best&#xfc;cken">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1539459428928" ID="ID_1156538064" MODIFIED="1539480704223" TEXT="best&#xfc;cken">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539394779490" ID="ID_1710199928" MODIFIED="1539394784490" TEXT="Verwalten der Tabs">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539394670721" ID="ID_1510868551" MODIFIED="1539394795397" TEXT="TimelineWidget &#xfc;bernehmen">
<node COLOR="#338800" CREATED="1539394670721" ID="ID_1510868551" MODIFIED="1539480717469" TEXT="TimelineWidget &#xfc;bernehmen">
<linktarget COLOR="#a678c8" DESTINATION="ID_1510868551" ENDARROW="Default" ENDINCLINATION="-587;-51;" ID="Arrow_ID_206932394" SOURCE="ID_50363803" STARTARROW="None" STARTINCLINATION="-699;0;"/>
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1539394802679" ID="ID_1716564275" MODIFIED="1539394807727" TEXT="neuen Tab daf&#xfc;r belegen">
<icon BUILTIN="flag-yellow"/>
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1539394802679" ID="ID_1716564275" MODIFIED="1539480719247" TEXT="neuen Tab daf&#xfc;r belegen">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1539480719942" ID="ID_1686433179" MODIFIED="1539480728421" TEXT="ggfs Platzhalter wegwerfen">
<icon BUILTIN="button_ok"/>
</node>
</node>
</node>