summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-05-06 01:09:16 +0200
committerCarl Hetherington <cth@carlh.net>2025-05-08 01:29:35 +0200
commitbd0ea5c90b5fa03224b7f89785c98976d8513d07 (patch)
tree9f1f9bd1ece557474d381780635cbe3986542e9d
parentdf0e7490c3375e9b695ccd462b66f183fe954362 (diff)
Limit allowable reel types (#3032).
-rw-r--r--src/wx/dcp_timeline.cc55
-rw-r--r--src/wx/dcp_timeline.h3
2 files changed, 54 insertions, 4 deletions
diff --git a/src/wx/dcp_timeline.cc b/src/wx/dcp_timeline.cc
index a51c18738..a5b106c00 100644
--- a/src/wx/dcp_timeline.cc
+++ b/src/wx/dcp_timeline.cc
@@ -31,6 +31,7 @@
#include "lib/atmos_content.h"
#include "lib/audio_content.h"
#include "lib/constants.h"
+#include "lib/dcp_content.h"
#include "lib/film.h"
#include "lib/text_content.h"
#include "lib/video_content.h"
@@ -166,6 +167,7 @@ DCPTimeline::DCPTimeline(wxWindow* parent, shared_ptr<Film> film)
_canvas->Bind(wxEVT_MOTION, boost::bind(&DCPTimeline::mouse_moved, this, _1));
_film_connection = film->Change.connect(boost::bind(&DCPTimeline::film_changed, this, _1, _2));
+ _film_content_connection = film->ContentChange.connect(boost::bind(&DCPTimeline::film_content_changed, this, _1, _3));
_menu = new wxMenu;
_add_reel_boundary = _menu->Append(ID_add_reel_boundary, _("Add reel boundary"));
@@ -220,6 +222,7 @@ DCPTimeline::film_changed(ChangeType type, FilmProperty property)
case FilmProperty::CONTENT:
case FilmProperty::CONTENT_ORDER:
setup_pixels_per_second();
+ setup_reel_types();
Refresh();
break;
default:
@@ -229,6 +232,53 @@ DCPTimeline::film_changed(ChangeType type, FilmProperty property)
void
+DCPTimeline::film_content_changed(ChangeType type, int property)
+{
+ if (type != ChangeType::DONE) {
+ return;
+ }
+
+ if (
+ property == DCPContentProperty::NEEDS_KDM ||
+ property == DCPContentProperty::NEEDS_ASSETS ||
+ property == DCPContentProperty::REFERENCE_VIDEO ||
+ property == DCPContentProperty::REFERENCE_AUDIO ||
+ property == DCPContentProperty::REFERENCE_TEXT) {
+ setup_reel_types();
+ }
+}
+
+
+void
+DCPTimeline::setup_reel_types()
+{
+ auto const possible = film()->possible_reel_types();
+
+ if (static_cast<int>(possible.size()) != _reel_type->size()) {
+ _reel_type->clear();
+ for (auto type: possible) {
+ switch (type) {
+ case ReelType::SINGLE:
+ _reel_type->add_entry(_("Single reel"), reel_type_to_string(ReelType::SINGLE));
+ break;
+ case ReelType::BY_VIDEO_CONTENT:
+ _reel_type->add_entry(_("Split by video content"), reel_type_to_string(ReelType::BY_VIDEO_CONTENT));
+ break;
+ case ReelType::BY_LENGTH:
+ _reel_type->add_entry(_("Split by maximum reel size"), reel_type_to_string(ReelType::BY_LENGTH));
+ break;
+ case ReelType::CUSTOM:
+ _reel_type->add_entry(_("Custom"), reel_type_to_string(ReelType::CUSTOM));
+ break;
+ }
+ }
+ }
+
+ _reel_type->set_by_data(reel_type_to_string(film()->reel_type()));
+}
+
+
+void
DCPTimeline::setup_sensitivity()
{
_snap->Enable(editable());
@@ -246,10 +296,7 @@ DCPTimeline::setup_reel_settings()
int r = 0;
add_label_to_sizer(sizer, _reel_settings, _("Reel mode"), true, wxGBPosition(r, 0));
_reel_type = new Choice(_reel_settings);
- _reel_type->add_entry(_("Single reel"));
- _reel_type->add_entry(_("Split by video content"));
- _reel_type->add_entry(_("Split by maximum reel size"));
- _reel_type->add_entry(_("Custom"));
+ setup_reel_types();
sizer->Add(_reel_type, wxGBPosition(r, 1));
++r;
diff --git a/src/wx/dcp_timeline.h b/src/wx/dcp_timeline.h
index e3ab386a8..e74adae8a 100644
--- a/src/wx/dcp_timeline.h
+++ b/src/wx/dcp_timeline.h
@@ -62,8 +62,10 @@ private:
void reel_mode_changed();
void maximum_reel_size_changed();
void film_changed(ChangeType type, FilmProperty property);
+ void film_content_changed(ChangeType type, int property);
std::shared_ptr<Film> film() const;
void setup_sensitivity();
+ void setup_reel_types();
void add_reel_boundary();
void remove_reel_boundary();
@@ -119,6 +121,7 @@ private:
wxMenuItem* _remove_reel_boundary;
boost::signals2::scoped_connection _film_connection;
+ boost::signals2::scoped_connection _film_content_connection;
std::vector<std::shared_ptr<ReelBoundary>> _reel_boundaries;
};