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)
5  2018, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
25 #include "stage/gtk-base.hpp"
26 #include "stage/style-scheme.hpp"
28 
29 //#include "stage/ui-bus.hpp"
30 //#include "lib/format-string.hpp"
31 //#include "lib/format-cout.hpp"
32 
33 #include "lib/util.hpp"
34 
35 //#include <algorithm>
36 //#include <vector>
37 
38 
40 
41 //using util::_Fmt;
42 using util::isnil;
43 //using util::contains;
44 //using Gtk::Widget;
45 //using sigc::mem_fun;
46 //using sigc::ptr_fun;
47 //using std::cout;
48 //using std::endl;
49 
50 
51 namespace stage {
52 namespace timeline {
53 
54  namespace {
55  const uint DEFAULT_OVERVIEW_HEIGHT_px = 20;
56 
57  const uint TIMERULER_SCALE_HEIGHT_px = 20;
58  const uint TIMERULER_LARGE_TICK_WEIGHT_px = 2;
59  const uint TIMERULER_SMALL_TICK_WEIGHT_px = 2;
60  const uint TIMERULE_GAP_BELOW_px = 5;
61  }
62 
63 
64 
65 
67  : Controller{id, nexus}
68  , track_{parent}
69  , scales_ {}
70  { }
71 
72 
73  RulerTrack::~RulerTrack() { }
74 
75  void
77  {
78  UNIMPLEMENTED ("what can actually be manipulated on a RulerTrack by diff message?");
79 
80 // buffer.emplace(
81 // TreeMutator::build()
82 // .change(ATTR_name, [&](string val)
83 // { // »Attribute Setter« : receive a new value for the track name field
84 // this->setTrackName (val);
85 // }));
86  }
87 
88 
93  uint
95  {
96  if (isnil (scales_))
97  return DEFAULT_OVERVIEW_HEIGHT_px;
98  else
99  { // handle time ruler ////////////////////////////////////////////////TICKET #1194 : proper handling of ruler tracks
100  uint combinedScaleHeight = 0;
101  for (auto& scale : scales_)
102  combinedScaleHeight += scale.calcHeight();
103  return combinedScaleHeight;
104  }
105  }
106 
112  uint
114  {
115  if (not isnil (scales_))
116  return TIMERULE_GAP_BELOW_px;
117  else
118  return 0; // no Gap
119 
120  }
121 
126  uint
128  {
129  return TIMERULER_SCALE_HEIGHT_px;
130  }
131 
132 
133 
134 }}// namespace stage::timeline
connection point at the UI-Bus.
Definition: bus-term.hpp:96
uint calcHeight()
recursively calculate the height in pixels to display this ruler track.
Definition: ruler-track.cpp:94
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:66
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBu...
Definition: record.hpp:104
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
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:76
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...