Lumiera  0.pre.03
»edit your freedom«
timeline-panel.cpp
Go to the documentation of this file.
1 /*
2  TimelinePanel - Dockable panel to hold the main timeline view
3 
4  Copyright (C) Lumiera.org
5  2016, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
23 
34 #include "stage/gtk-base.hpp"
38 
39 using std::make_unique;
40 
41 
42 namespace stage {
43 namespace panel {
44 
45  using timeline::TimelinePage;
46  using timeline::TimelineWidget;
47  using timeline::TimelineWidgetEmpty;
48 
49 
51  Gdl::DockItem& dockItem)
52  : Panel(panelManager, dockItem, getTitle(), getStockID())
53  , tabs_{}
54  , pages_{}
55  {
56  addTimeline (PageHandle{new TimelineWidgetEmpty{}});
57 
58  // show everything....
59  this->add(tabs_);
60  this->show_all();
61  }
62 
63  const char*
64  TimelinePanel::getTitle()
65  {
66  return _("Timeline");
67  }
68 
69  const gchar*
70  TimelinePanel::getStockID()
71  {
72  return "panel_timeline";
73  }
74 
75 
76  namespace {
77  template<class P>
78  inline bool
79  isEmptyTimeline (P const& pages)
80  {
81  return 1 == pages.size()
82  and dynamic_cast<TimelineWidgetEmpty*> (pages[0].get());
83  }
84  }
85 
86  void
87  TimelinePanel::addTimeline (PageHandle&& pTimelineWidget)
88  {
89  if (isEmptyTimeline (pages_))
90  {
91  tabs_.remove_page();
92  pages_.clear();
93  }
94  pages_.push_back (move (pTimelineWidget));
95  TimelinePage& addedPage = *pages_.back();
96  tabs_.append_page (addedPage, addedPage.getLabel());
97  }
98 
99 
100 }} // namespace stage::panel
Interface: GUI page holding a timeline display.
Empty placeholder to be rendered when the UI starts without session.
A class to manage DockItem objects for WorkspaceWindow.
The base class for all dockable panels.
Definition: panel.hpp:49
Placeholder to show when no actual Timeline is present.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
TimelinePanel(workspace::PanelManager &, Gdl::DockItem &)
void addTimeline(PageHandle &&)
take ownership of the widget and place it into a new tab
A set of basic GTK includes for the UI.
This file defines the core component of the Lumiera GUI.
A dockable container to hold a notebook of timeline displays.