From d9ab996fa416ba27b69bb65f047a1a1aa4063f1b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 17 May 2020 23:18:15 +0200 Subject: [PATCH] Add a new "Advanced settings" dialog for content, accessible 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 | 54 +++++++++++++++++++++++++++++++ src/wx/content_advanced_dialog.h | 39 ++++++++++++++++++++++ src/wx/content_menu.cc | 17 +++++++++- src/wx/content_menu.h | 2 ++ src/wx/video_panel.cc | 34 ++++--------------- src/wx/video_panel.h | 2 -- src/wx/wscript | 1 + 7 files changed, 119 insertions(+), 30 deletions(-) create mode 100644 src/wx/content_advanced_dialog.cc create mode 100644 src/wx/content_advanced_dialog.h diff --git a/src/wx/content_advanced_dialog.cc b/src/wx/content_advanced_dialog.cc new file mode 100644 index 000000000..c97047c73 --- /dev/null +++ b/src/wx/content_advanced_dialog.cc @@ -0,0 +1,54 @@ +/* + Copyright (C) 2020 Carl Hetherington + + 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 . + +*/ + +#include "content_advanced_dialog.h" +#include "lib/content.h" +#include "lib/video_content.h" +#include + +using boost::bind; +using boost::shared_ptr; + +ContentAdvancedDialog::ContentAdvancedDialog (wxWindow* parent, shared_ptr 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(_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 index 000000000..79b4be85c --- /dev/null +++ b/src/wx/content_advanced_dialog.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2020 Carl Hetherington + + 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 . + +*/ + + +#include "table_dialog.h" +#include + + +class Content; + + +class ContentAdvancedDialog : public TableDialog +{ +public: + ContentAdvancedDialog (wxWindow* parent, boost::shared_ptr content); + +private: + void ignore_video_changed (wxCommandEvent& ev); + + boost::shared_ptr _content; +}; + diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index d28253c6a..e9b6c3240 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016 Carl Hetherington + Copyright (C) 2013-2020 Carl Hetherington 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, 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) { diff --git a/src/wx/content_menu.h b/src/wx/content_menu.h index fe8cbb56f..756c1675a 100644 --- a/src/wx/content_menu.h +++ b/src/wx/content_menu.h @@ -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; diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 24099e1cc..4be9a741f 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -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 ( 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 check; - BOOST_FOREACH (shared_ptr 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 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 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 i, _parent->selected_video()) { - i->video->set_use (_use->GetValue()); - } -} void VideoPanel::reference_clicked () diff --git a/src/wx/video_panel.h b/src/wx/video_panel.h index 31aeed2e1..b74318f2f 100644 --- a/src/wx/video_panel.h +++ b/src/wx/video_panel.h @@ -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* _frame_type; wxStaticText* _crop_label; diff --git a/src/wx/wscript b/src/wx/wscript index a2fbe0c4e..c6e8362dd 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -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 -- 2.30.2