summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-12-13 23:03:01 +0100
committerCarl Hetherington <cth@carlh.net>2024-03-12 00:43:51 +0100
commitf81655002b1ef1427e2845dc5d354da6020bfafb (patch)
tree4dc3fff301f9475449ebc2b467e315ee60ad738d /src/wx
parent1910147fd58ac58a21b8f3b874495179aa5424ab (diff)
Split out Timeline from ContentTimeline.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/content_timeline.cc11
-rw-r--r--src/wx/content_timeline.h10
-rw-r--r--src/wx/timeline.cc42
-rw-r--r--src/wx/timeline.h50
-rw-r--r--src/wx/wscript1
5 files changed, 96 insertions, 18 deletions
diff --git a/src/wx/content_timeline.cc b/src/wx/content_timeline.cc
index 368cbcca4..d5ed0f7bb 100644
--- a/src/wx/content_timeline.cc
+++ b/src/wx/content_timeline.cc
@@ -63,13 +63,11 @@ using namespace boost::placeholders;
#endif
-/* 3 hours in 640 pixels */
-double const ContentTimeline::_minimum_pixels_per_second = 640.0 / (60 * 60 * 3);
int const ContentTimeline::_minimum_pixels_per_track = 16;
ContentTimeline::ContentTimeline(wxWindow* parent, ContentPanel* cp, shared_ptr<Film> film, FilmViewer& viewer)
- : wxPanel (parent, wxID_ANY)
+ : Timeline(parent)
, _labels_canvas (new wxScrolledCanvas (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE))
, _main_canvas (new wxScrolledCanvas (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE))
, _content_panel (cp)
@@ -185,13 +183,6 @@ ContentTimeline::update_playhead()
void
-ContentTimeline::set_pixels_per_second(double pps)
-{
- _pixels_per_second = max (_minimum_pixels_per_second, pps);
-}
-
-
-void
ContentTimeline::paint_labels()
{
wxPaintDC dc (_labels_canvas);
diff --git a/src/wx/content_timeline.h b/src/wx/content_timeline.h
index 994f18ad4..10f880191 100644
--- a/src/wx/content_timeline.h
+++ b/src/wx/content_timeline.h
@@ -20,6 +20,7 @@
#include "content_menu.h"
+#include "timeline.h"
#include "timeline_content_view.h"
#include "lib/film_property.h"
#include "lib/rect.h"
@@ -39,7 +40,7 @@ class TimelineReelsView;
class TimelineTimeAxisView;
-class ContentTimeline : public wxPanel
+class ContentTimeline : public Timeline
{
public:
ContentTimeline(wxWindow *, ContentPanel *, std::shared_ptr<Film>, FilmViewer& viewer);
@@ -54,10 +55,6 @@ public:
return _pixels_per_track;
}
- boost::optional<double> pixels_per_second () const {
- return _pixels_per_second;
- }
-
int tracks () const;
void set_snap (bool s) {
@@ -106,7 +103,6 @@ private:
void recreate_views ();
void setup_scrollbars ();
void scrolled (wxScrollWinEvent& ev);
- void set_pixels_per_second (double pps);
void set_pixels_per_track (int h);
void zoom_all ();
void update_playhead ();
@@ -127,7 +123,6 @@ private:
std::shared_ptr<TimelineReelsView> _reels_view;
std::shared_ptr<TimelineLabelsView> _labels_view;
int _tracks;
- boost::optional<double> _pixels_per_second;
bool _left_down;
wxPoint _down_point;
boost::optional<wxPoint> _zoom_point;
@@ -147,7 +142,6 @@ private:
boost::optional<int> _last_mouse_wheel_x;
boost::optional<double> _last_mouse_wheel_time;
- static double const _minimum_pixels_per_second;
static int const _minimum_pixels_per_track;
boost::signals2::scoped_connection _film_changed_connection;
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
new file mode 100644
index 000000000..329f4ef00
--- /dev/null
+++ b/src/wx/timeline.cc
@@ -0,0 +1,42 @@
+/*
+ Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "timeline.h"
+
+
+/* 3 hours in 640 pixels */
+double constexpr minimum_pixels_per_second = 640.0 / (60 * 60 * 3);
+
+
+Timeline::Timeline(wxWindow* parent)
+ : wxPanel(parent, wxID_ANY)
+{
+
+}
+
+
+void
+Timeline::set_pixels_per_second(double pps)
+{
+ _pixels_per_second = std::max(minimum_pixels_per_second, pps);
+}
+
+
diff --git a/src/wx/timeline.h b/src/wx/timeline.h
new file mode 100644
index 000000000..cc35913b9
--- /dev/null
+++ b/src/wx/timeline.h
@@ -0,0 +1,50 @@
+/*
+ Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef DCPOMATIC_TIMELINE_H
+#define DCPOMATIC_TIMELINE_H
+
+
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
+#include <wx/wx.h>
+LIBDCP_ENABLE_WARNINGS
+#include <boost/optional.hpp>
+
+
+class Timeline : public wxPanel
+{
+public:
+ explicit Timeline(wxWindow* parent);
+
+ boost::optional<double> pixels_per_second() const {
+ return _pixels_per_second;
+ }
+
+
+protected:
+ void set_pixels_per_second(double pps);
+
+ boost::optional<double> _pixels_per_second;
+};
+
+
+#endif
diff --git a/src/wx/wscript b/src/wx/wscript
index 830d76731..2693bfa57 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -162,6 +162,7 @@ sources = """
time_picker.cc
timer_display.cc
timecode.cc
+ timeline.cc
timeline_atmos_content_view.cc
timeline_content_view.cc
timeline_dialog.cc