Lumiera  0.pre.03
»edit your freedom«
ruler-track.cpp
Go to the documentation of this file.
1 /*
2  RulerTrack - track body area to show overview and timecode and markers
3 
4  Copyright (C) Lumiera.org
5  2018, 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"
35 #include "stage/style-scheme.hpp"
37 
38 //#include "stage/ui-bus.hpp"
39 //#include "lib/format-string.hpp"
40 //#include "lib/format-cout.hpp"
41 
42 #include "lib/util.hpp"
43 
44 //#include <algorithm>
45 //#include <vector>
46 
47 
49 
50 //using util::_Fmt;
51 using util::isnil;
52 //using util::contains;
53 //using Gtk::Widget;
54 //using sigc::mem_fun;
55 //using sigc::ptr_fun;
56 //using std::cout;
57 //using std::endl;
58 
59 
60 namespace stage {
61 namespace timeline {
62 
63  namespace {
64  const uint DEFAULT_OVERVIEW_HEIGHT_px = 20;
65 
66  const uint TIMERULER_SCALE_HEIGHT_px = 20;
67  const uint TIMERULER_LARGE_TICK_WEIGHT_px = 2;
68  const uint TIMERULER_SMALL_TICK_WEIGHT_px = 2;
69  const uint TIMERULE_GAP_BELOW_px = 5;
70  }
71 
72 
73 
74 
76  : Controller{id, nexus}
77  , track_{parent}
78  , scales_ {}
79  { }
80 
81 
82  RulerTrack::~RulerTrack() { }
83 
84  void
86  {
87  UNIMPLEMENTED ("what can actually be manipulated on a RulerTrack by diff message?");
88 
89 // buffer.emplace(
90 // TreeMutator::build()
91 // .change(ATTR_name, [&](string val)
92 // { // »Attribute Setter« : receive a new value for the track name field
93 // this->setTrackName (val);
94 // }));
95  }
96 
97 
102  uint
104  {
105  if (isnil (scales_))
106  return DEFAULT_OVERVIEW_HEIGHT_px;
107  else
108  { // handle time ruler ////////////////////////////////////////////////TICKET #1194 : proper handling of ruler tracks
109  uint combinedScaleHeight = 0;
110  for (auto& scale : scales_)
111  combinedScaleHeight += scale.calcHeight();
112  return combinedScaleHeight;
113  }
114  }
115 
121  uint
123  {
124  if (not isnil (scales_))
125  return TIMERULE_GAP_BELOW_px;
126  else
127  return 0; // no Gap
128 
129  }
130 
135  uint
137  {
138  return TIMERULER_SCALE_HEIGHT_px;
139  }
140 
141 
142 
143 }}// namespace stage::timeline
connection point at the UI-Bus.
Definition: bus-term.hpp:105
uint calcHeight()
recursively calculate the height in pixels to display this ruler track.
uint calcHeight()
get vertical extension of this scale on the time(code) overview ruler
uint getGapHeight()
possibly cause the display of an additional padding gap below this ruler track
A View-Model entity to represent a timeline track in the UI.
RulerTrack(ID id, ctrl::BusTerm &nexus, TrackPresenter &parent)
Definition: ruler-track.cpp:75
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBu...
Definition: record.hpp:113
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
virtual void buildMutator(lib::diff::TreeMutator::Handle) override
set up a binding to respond to mutation messages via UiBus
Definition: ruler-track.cpp:85
Timeline presentation helper to organise drawing of the overview rulers.
Definition of access keys for uniform UI styling.
A set of basic GTK includes for the UI.
Customisable intermediary to abstract mutating operations on arbitrary, hierarchical object-like data...