Make the advanced content dialogue properly respect OK/Cancel.
[dcpomatic.git] / src / wx / content_menu.cc
index 6c4864239223e06e58fa842f4fe9cf5ac4364957..cae56283bbfde0673f2dd716bbfb8b0e57248aff 100644 (file)
@@ -43,6 +43,7 @@
 #include "lib/image_content.h"
 #include "lib/job_manager.h"
 #include "lib/playlist.h"
+#include "lib/scope_guard.h"
 #include "lib/video_content.h"
 #include <dcp/cpl.h>
 #include <dcp/decrypted_kdm.h>
@@ -461,9 +462,31 @@ ContentMenu::properties ()
 void
 ContentMenu::advanced ()
 {
-       auto d = new ContentAdvancedDialog (_parent, _content.front());
-       d->ShowModal ();
-       d->Destroy ();
+       DCPOMATIC_ASSERT(!_content.empty());
+
+       auto content = _content.front();
+       auto dialog = new ContentAdvancedDialog(_parent, content);
+       ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+
+       if (dialog->ShowModal() == wxID_CANCEL) {
+               return;
+       }
+
+       if (content->video) {
+               content->video->set_use(!dialog->ignore_video());
+               content->video->set_burnt_subtitle_language(dialog->burnt_subtitle_language());
+       }
+
+       auto ffmpeg = dynamic_pointer_cast<FFmpegContent>(content);
+       if (ffmpeg) {
+               ffmpeg->set_filters(dialog->filters());
+       }
+
+       if (dialog->video_frame_rate()) {
+               content->set_video_frame_rate(*dialog->video_frame_rate());
+       } else {
+               content->unset_video_frame_rate();
+       }
 }