From 67cccbdc5da195641fc1811f142aafd69add6ee7 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 13 Oct 2018 23:58:49 +0200 Subject: [PATCH] Timeline: actually accept and install the TimelineWidget As starting point, provide an empty placeholder widget to fill the void --- src/gui/panel/timeline-panel.cpp | 39 +++++------ src/gui/panel/timeline-panel.hpp | 20 +++--- src/gui/timeline/timeline-controller.hpp | 8 ++- src/gui/timeline/timeline-gui.cpp | 2 +- src/gui/timeline/timeline-widget-empty.cpp | 80 ---------------------- src/gui/timeline/timeline-widget-empty.hpp | 80 +++++++++++++--------- src/gui/timeline/timeline-widget.cpp | 8 +++ src/gui/timeline/timeline-widget.hpp | 10 ++- wiki/thinkPad.ichthyo.mm | 51 +++++++------- 9 files changed, 125 insertions(+), 173 deletions(-) delete mode 100644 src/gui/timeline/timeline-widget-empty.cpp diff --git a/src/gui/panel/timeline-panel.cpp b/src/gui/panel/timeline-panel.cpp index 38c6fe81f..7bd68d0b7 100644 --- a/src/gui/panel/timeline-panel.cpp +++ b/src/gui/panel/timeline-panel.cpp @@ -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 -//#include -//#include - - - -//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 (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()); } diff --git a/src/gui/panel/timeline-panel.hpp b/src/gui/panel/timeline-panel.hpp index 3d52aefa6..4691cd133 100644 --- a/src/gui/panel/timeline-panel.hpp +++ b/src/gui/panel/timeline-panel.hpp @@ -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: diff --git a/src/gui/timeline/timeline-controller.hpp b/src/gui/timeline/timeline-controller.hpp index 44df1e57c..07ce4609c 100644 --- a/src/gui/timeline/timeline-controller.hpp +++ b/src/gui/timeline/timeline-controller.hpp @@ -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 ===== */ diff --git a/src/gui/timeline/timeline-gui.cpp b/src/gui/timeline/timeline-gui.cpp index 332e4b456..6e78f04c5 100644 --- a/src/gui/timeline/timeline-gui.cpp +++ b/src/gui/timeline/timeline-gui.cpp @@ -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) diff --git a/src/gui/timeline/timeline-widget-empty.cpp b/src/gui/timeline/timeline-widget-empty.cpp deleted file mode 100644 index 2874af081..000000000 --- a/src/gui/timeline/timeline-widget-empty.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - TimelineWidgetEmpty - placeholder widget for a missing timeline - - Copyright (C) Lumiera.org - 2016, 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 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 -//#include - - - -//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 diff --git a/src/gui/timeline/timeline-widget-empty.hpp b/src/gui/timeline/timeline-widget-empty.hpp index 3e9d17d6e..6d587427f 100644 --- a/src/gui/timeline/timeline-widget-empty.hpp +++ b/src/gui/timeline/timeline-widget-empty.hpp @@ -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 -//#include - 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 ("-- the great actor Joseph Tura"); + 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_); + } }; diff --git a/src/gui/timeline/timeline-widget.cpp b/src/gui/timeline/timeline-widget.cpp index 9d6c7b787..90e037ff7 100644 --- a/src/gui/timeline/timeline-widget.cpp +++ b/src/gui/timeline/timeline-widget.cpp @@ -83,5 +83,13 @@ namespace timeline { } + cuString + TimelineWidget::getLabel() const + { + control_->getName(); + } + + + }}// namespace gui::timeline diff --git a/src/gui/timeline/timeline-widget.hpp b/src/gui/timeline/timeline-widget.hpp index 68581bc7b..9fcb9853b 100644 --- a/src/gui/timeline/timeline-widget.hpp +++ b/src/gui/timeline/timeline-widget.hpp @@ -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 ===== */ diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 1a2cc5268..d705c39c1 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -5243,18 +5243,18 @@ - + - - - + + + - - + + - - + + @@ -16501,8 +16501,8 @@ - - + + @@ -16517,19 +16517,19 @@ - + - + - + - + @@ -19050,29 +19050,32 @@ - + - + - - + + - - + + - + - - - + + + + + +