Add a new "Advanced settings" dialog for content, accessible
authorCarl Hetherington <cth@carlh.net>
Sun, 17 May 2020 21:18:15 +0000 (23:18 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 17 May 2020 23:37:25 +0000 (01:37 +0200)
from the right-click menu.  Move the "use video" checkbox into
here, as it feels like excessive clutter to have it in the main
video panel.

Maybe other things should be hidden in here.  I'm looking at you,
video filters...

src/wx/content_advanced_dialog.cc [new file with mode: 0644]
src/wx/content_advanced_dialog.h [new file with mode: 0644]
src/wx/content_menu.cc
src/wx/content_menu.h
src/wx/video_panel.cc
src/wx/video_panel.h
src/wx/wscript

diff --git a/src/wx/content_advanced_dialog.cc b/src/wx/content_advanced_dialog.cc
new file mode 100644 (file)
index 0000000..c97047c
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+    Copyright (C) 2020 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 "content_advanced_dialog.h"
+#include "lib/content.h"
+#include "lib/video_content.h"
+#include <boost/bind.hpp>
+
+using boost::bind;
+using boost::shared_ptr;
+
+ContentAdvancedDialog::ContentAdvancedDialog (wxWindow* parent, shared_ptr<Content> content)
+       : TableDialog (parent, _("Advanced content settings"), 2, 0, false)
+       , _content (content)
+{
+       wxCheckBox* ignore_video = new wxCheckBox (this, wxID_ANY, _("Ignore this content's video and use only audio, subtitles and closed captions"));
+       add (ignore_video);
+       add_spacer ();
+
+       layout ();
+
+       ignore_video->Enable (static_cast<bool>(_content->video));
+       ignore_video->SetValue (_content->video ? !content->video->use() : false);
+
+       ignore_video->Bind (wxEVT_CHECKBOX, bind(&ContentAdvancedDialog::ignore_video_changed, this, _1));
+}
+
+
+void
+ContentAdvancedDialog::ignore_video_changed (wxCommandEvent& ev)
+{
+        if (_content->video) {
+                _content->video->set_use (!ev.IsChecked());
+        }
+}
+
+
diff --git a/src/wx/content_advanced_dialog.h b/src/wx/content_advanced_dialog.h
new file mode 100644 (file)
index 0000000..79b4be8
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+    Copyright (C) 2020 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 "table_dialog.h"
+#include <boost/shared_ptr.hpp>
+
+
+class Content;
+
+
+class ContentAdvancedDialog : public TableDialog
+{
+public:
+       ContentAdvancedDialog (wxWindow* parent, boost::shared_ptr<Content> content);
+
+private:
+       void ignore_video_changed (wxCommandEvent& ev);
+
+       boost::shared_ptr<Content> _content;
+};
+
index d28253c6a1b88dfef97426534ecbf8e70ae1fa1f..e9b6c32409cebe8e43f647bc7b64a340675c024d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -24,6 +24,7 @@
 #include "timeline_video_content_view.h"
 #include "timeline_audio_content_view.h"
 #include "content_properties_dialog.h"
+#include "content_advanced_dialog.h"
 #include "lib/playlist.h"
 #include "lib/film.h"
 #include "lib/image_content.h"
@@ -58,6 +59,7 @@ enum {
        ID_join,
        ID_find_missing,
        ID_properties,
+       ID_advanced,
        ID_re_examine,
        ID_kdm,
        ID_ov,
@@ -75,6 +77,7 @@ ContentMenu::ContentMenu (wxWindow* p)
        _join = _menu->Append (ID_join, _("Join"));
        _find_missing = _menu->Append (ID_find_missing, _("Find missing..."));
        _properties = _menu->Append (ID_properties, _("Properties..."));
+       _advanced = _menu->Append (ID_advanced, _("Advanced settings..."));
        _re_examine = _menu->Append (ID_re_examine, _("Re-examine..."));
        _menu->AppendSeparator ();
        _kdm = _menu->Append (ID_kdm, _("Add KDM..."));
@@ -89,6 +92,7 @@ ContentMenu::ContentMenu (wxWindow* p)
        _parent->Bind (wxEVT_MENU, boost::bind (&ContentMenu::join, this), ID_join);
        _parent->Bind (wxEVT_MENU, boost::bind (&ContentMenu::find_missing, this), ID_find_missing);
        _parent->Bind (wxEVT_MENU, boost::bind (&ContentMenu::properties, this), ID_properties);
+       _parent->Bind (wxEVT_MENU, boost::bind (&ContentMenu::advanced, this), ID_advanced);
        _parent->Bind (wxEVT_MENU, boost::bind (&ContentMenu::re_examine, this), ID_re_examine);
        _parent->Bind (wxEVT_MENU, boost::bind (&ContentMenu::kdm, this), ID_kdm);
        _parent->Bind (wxEVT_MENU, boost::bind (&ContentMenu::ov, this), ID_ov);
@@ -122,6 +126,7 @@ ContentMenu::popup (weak_ptr<Film> film, ContentList c, TimelineContentViewList
 
        _find_missing->Enable (_content.size() == 1 && !_content.front()->paths_valid ());
        _properties->Enable (_content.size() == 1);
+       _advanced->Enable (_content.size() == 1);
        _re_examine->Enable (!_content.empty ());
 
        if (_content.size() == 1) {
@@ -445,6 +450,16 @@ ContentMenu::properties ()
        d->Destroy ();
 }
 
+
+void
+ContentMenu::advanced ()
+{
+       ContentAdvancedDialog* d = new ContentAdvancedDialog (_parent, _content.front());
+       d->ShowModal ();
+       d->Destroy ();
+}
+
+
 void
 ContentMenu::cpl_selected (wxCommandEvent& ev)
 {
index fe8cbb56f0fc9a4b2161cb41902cf9d2887db549..756c1675a7c111a9c6120023142aea168a2425aa 100644 (file)
@@ -43,6 +43,7 @@ private:
        void join ();
        void find_missing ();
        void properties ();
+       void advanced ();
        void re_examine ();
        void kdm ();
        void ov ();
@@ -63,6 +64,7 @@ private:
        wxMenuItem* _join;
        wxMenuItem* _find_missing;
        wxMenuItem* _properties;
+       wxMenuItem* _advanced;
        wxMenuItem* _re_examine;
        wxMenuItem* _kdm;
        wxMenuItem* _ov;
index 24099e1ccd97ed2b524ce31a9bc20490542e4e25..4be9a741fd72b338a9fe7039595eb2fa480f6c4b 100644 (file)
@@ -69,8 +69,6 @@ VideoPanel::VideoPanel (ContentPanel* p)
        font.SetPointSize(font.GetPointSize() - 1);
        _reference_note->SetFont(font);
 
-       _use = new wxCheckBox (this, wxID_ANY, _("Use"));
-
        _type_label = create_label (this, _("Type"), true);
        _frame_type = new ContentChoice<VideoContent, VideoFrameType> (
                this,
@@ -194,7 +192,6 @@ VideoPanel::VideoPanel (ContentPanel* p)
        _fade_in->Changed.connect (boost::bind (&VideoPanel::fade_in_changed, this));
        _fade_out->Changed.connect (boost::bind (&VideoPanel::fade_out_changed, this));
 
-       _use->Bind                           (wxEVT_CHECKBOX, boost::bind (&VideoPanel::use_clicked, this));
        _reference->Bind                     (wxEVT_CHECKBOX, boost::bind (&VideoPanel::reference_clicked, this));
        _filters_button->Bind                (wxEVT_BUTTON,   boost::bind (&VideoPanel::edit_filters_clicked, this));
        _scale_fit->Bind                     (wxEVT_RADIOBUTTON, boost::bind (&VideoPanel::scale_fit_clicked, this));
@@ -227,10 +224,6 @@ VideoPanel::add_to_grid ()
                ++r;
        }
 
-       _use->Show (full);
-       _grid->Add (_use, wxGBPosition(r, 0), wxGBSpan(1, 2));
-       ++r;
-
        add_label_to_sizer (_grid, _type_label, true, wxGBPosition(r, 0));
        _frame_type->add (_grid, wxGBPosition(r, 1), wxGBSpan(1, 2));
        ++r;
@@ -428,17 +421,6 @@ VideoPanel::film_content_changed (int property)
                        }
                }
        } else if (property == VideoContentProperty::USE) {
-               set<bool> check;
-               BOOST_FOREACH (shared_ptr<const Content> i, vc) {
-                       check.insert (i->video->use());
-               }
-
-               if (check.size() == 1) {
-                       checked_set (_use, vc.front()->video->use());
-               } else {
-                       checked_set (_use, false);
-               }
-
                setup_sensitivity ();
        } else if (property == VideoContentProperty::FADE_IN) {
                set<Frame> check;
@@ -625,9 +607,14 @@ VideoPanel::setup_sensitivity ()
        }
        setup_refer_button (_reference, _reference_note, dcp, can_reference, cannot);
 
-       bool const enable = !_reference->GetValue() && _use->GetValue();
+       bool any_use = false;
+       BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
+               if (i->video && i->video->use()) {
+                       any_use = true;
+               }
+       }
 
-       _use->Enable (!_reference->GetValue());
+       bool const enable = !_reference->GetValue() && any_use;
 
        if (!enable) {
                _frame_type->wrapped()->Enable (false);
@@ -698,13 +685,6 @@ VideoPanel::fade_out_changed ()
        }
 }
 
-void
-VideoPanel::use_clicked ()
-{
-       BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
-               i->video->set_use (_use->GetValue());
-       }
-}
 
 void
 VideoPanel::reference_clicked ()
index 31aeed2e1d36ea166d1df8e635391ca8b692bf09..b74318f2f6cc8514af42cb600cfb782ce8ae879a 100644 (file)
@@ -46,7 +46,6 @@ public:
        void content_selection_changed ();
 
 private:
-       void use_clicked ();
        void reference_clicked ();
        void edit_filters_clicked ();
        void colour_conversion_changed ();
@@ -70,7 +69,6 @@ private:
 
        wxCheckBox* _reference;
        wxStaticText* _reference_note;
-       wxCheckBox* _use;
        wxStaticText* _type_label;
        ContentChoice<VideoContent, VideoFrameType>* _frame_type;
        wxStaticText* _crop_label;
index a2fbe0c4ea5752392f9123b3d3d899d5559289d3..c6e8362ddf802b1fbc711ae5746587f9115192e2 100644 (file)
@@ -40,6 +40,7 @@ sources = """
           config_dialog.cc
           config_move_dialog.cc
           confirm_kdm_email_dialog.cc
+          content_advanced_dialog.cc
           content_colour_conversion_dialog.cc
           content_menu.cc
           content_panel.cc