Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
body-canvas-widget.hpp
Go to the documentation of this file.
1/*
2 BODY-CANVAS-WIDGET.hpp - custom drawing canvas to display the timeline body
3
4 Copyright (C)
5 2016, 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
63#ifndef STAGE_TIMELINE_BODY_CANVAS_WIDGET_H
64#define STAGE_TIMELINE_BODY_CANVAS_WIDGET_H
65
66#include "stage/gtk-base.hpp"
70
71#include <functional>
72
73
74
75namespace stage {
76namespace timeline {
77
79
80 using PAdjustment = Glib::RefPtr<Gtk::Adjustment>;
81 using CairoC = Cairo::RefPtr<Cairo::Context> const&;
82
83 class DisplayManager;
84 class TrackBody;
85 class TimelineCanvas;
86
87
89 : public Gtk::Layout
90 {
91 using _Renderer = std::function<void(CairoC)>;
92
95
96 public:
97 TimelineCanvas (_Renderer groundingFun, _Renderer overlayFun);
98 virtual ~TimelineCanvas() { }
99
100 private:
101 virtual bool on_draw (CairoC) override;
102
103 void openCanvas (CairoC);
104 void closeCanvas (CairoC);
105
106 void drawGrounding (CairoC);
107 void drawOverlays (CairoC);
108 };
109
110
131 : public Gtk::Box
132 , public model::CanvasHook<Gtk::Widget>
133 , public LayoutElement
134 {
138
139 Gtk::ScrolledWindow contentArea_;
140 Gtk::ScrolledWindow rulerArea_;
143
144 public:
147
149 void installForkRoot (TrackBody& rootTrackBody);
150 void forceRedraw();
151 void disable();
152
154 auto get_vadjustment() { return contentArea_.get_vadjustment(); }
155 auto get_hadjustment() { return contentArea_.get_hadjustment(); }
156
158 using ProfileGetter = std::function<TrackProfile&()>;
159
160
161 protected: /* ==== Interface: CanvasHook ===== */
162
163 void hook (Gtk::Widget&, int xPos=0, int yPos=0) override;
164 void move (Gtk::Widget&, int xPos, int yPos) override;
165 void remove (Gtk::Widget&) override;
166
167 model::DisplayMetric& getMetric() const override;
168
169 protected: /* ==== Interface: LayoutElement ===== */
170
171 void establishLayout (DisplayEvaluation&) override;
172 void completeLayout (DisplayEvaluation&) override;
173
174 private:/* ===== Internals ===== */
176
177 TimelineCanvas& getCanvas(int yPos);
178 void slotStructureChange() noexcept;
179 void maybeRebuildLayout();
180 void adjustCanvasSize(int canvasWidth, int totalHeight, int rulerHeight);
181 };
182
183
184}}// namespace stage::timeline
185#endif /*STAGE_TIMELINE_BODY_CANVAS_WIDGET_H*/
Specialised (abstracted) presentation context with positioning by coordinates.
basic constant internal time value.
Interface to represent _"some presentation layout entity",_ with the ability to place widgets (manage...
Mix-in interface to allow for concrete CanvasHooked widgets to adapt themselves to the metric current...
Presentation of the timeline workspace by custom drawing on a canvas.
void adjustCanvasSize(int canvasWidth, int totalHeight, int rulerHeight)
After the (recent) display evaluation pass has negotiated the required space for the currently presen...
void slotStructureChange() noexcept
force rebuilding of theTrackProfile whenever the global timeline structure changes
void hook(Gtk::Widget &, int xPos=0, int yPos=0) override
model::DisplayMetric & getMetric() const override
access the component to handle layout metric
void installForkRoot(TrackBody &rootTrackBody)
The Lumiera Timeline model does not rely on a list of tracks, as most conventional video editing soft...
void establishLayout(DisplayEvaluation &) override
respond to the DisplayEvaluation pass.
void maybeRebuildLayout()
Possibly (re)build the allocation and distribution of layout space.
void completeLayout(DisplayEvaluation &) override
void move(Gtk::Widget &, int xPos, int yPos) override
void remove(Gtk::Widget &) override
std::function< TrackProfile &()> ProfileGetter
a way to get and possibly (re)compute the current TrackProfile
TimelineCanvas & getCanvas(int yPos)
Visitor and state holder for a collaborative layout adjustment pass.
Interface for coordination of the overall timeline display.
void openCanvas(CairoC)
Prepare the drawing canvas to work within our virtual canvas coordinate system.
virtual bool on_draw(CairoC) override
Custom drawing of the timeline content area.
void drawGrounding(CairoC)
Establish and render the structure of (possibly nested) tracks and overview rulers.
void closeCanvas(CairoC)
Finish and close the virtual drawing canvas established by openCanvas().
std::function< void(CairoC)> _Renderer
Helper to organise and draw the space allocated for a fork of sub-tracks.
Description of the structure and arrangement of tracks for display in the UI.
A collaboration to establish a globally coherent timeline display layout.
A set of basic GTK includes for the UI.
PCairoContext const & CairoC
Glib::RefPtr< Gtk::Adjustment > PAdjustment
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37
Abstraction to build the layout for the track spaces within timeline display.