more
authorCarl Hetherington <cth@carlh.net>
Sat, 24 Sep 2022 19:19:00 +0000 (21:19 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 24 Sep 2022 19:19:00 +0000 (21:19 +0200)
src/tools/dcpomatic.cc
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
src/wx/film_editor.cc
src/wx/film_editor.h

index 7d6a93841efd1424f68ee56904ed6fe03bc3f771..3bef6d9ada2c5da70b22909308cfb3acf0d59a1b 100644 (file)
@@ -1,216 +1,6 @@
-/*
-    Copyright (C) 2012-2021 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/>.
-
-*/
-
-
-/** @file  src/tools/dcpomatic.cc
- *  @brief The main DCP-o-matic GUI.
- */
-
-
-#include "wx/about_dialog.h"
-#include "wx/content_panel.h"
-#include "wx/dkdm_dialog.h"
-#include "wx/export_subtitles_dialog.h"
-#include "wx/export_video_file_dialog.h"
 #include "wx/film_editor.h"
-#include "wx/film_name_location_dialog.h"
 #include "wx/film_viewer.h"
-#include "wx/focus_manager.h"
-#include "wx/full_config_dialog.h"
-#include "wx/hints_dialog.h"
-#include "wx/html_dialog.h"
-#include "wx/i18n_hook.h"
-#include "wx/job_manager_view.h"
-#include "wx/kdm_dialog.h"
-#include "wx/nag_dialog.h"
-#include "wx/paste_dialog.h"
-#include "wx/recreate_chain_dialog.h"
-#include "wx/report_problem_dialog.h"
-#include "wx/save_template_dialog.h"
-#include "wx/self_dkdm_dialog.h"
-#include "wx/send_i18n_dialog.h"
-#include "wx/servers_list_dialog.h"
-#include "wx/system_information_dialog.h"
-#include "wx/templates_dialog.h"
-#include "wx/update_dialog.h"
-#include "wx/video_waveform_dialog.h"
-#include "wx/wx_signal_manager.h"
-#include "wx/wx_util.h"
-#include "lib/analytics.h"
-#include "lib/audio_content.h"
-#include "lib/check_content_job.h"
-#include "lib/cinema.h"
-#include "lib/compose.hpp"
-#include "lib/config.h"
-#include "lib/content.h"
-#include "lib/content_factory.h"
-#include "lib/cross.h"
-#include "lib/cross.h"
-#include "lib/dcp_content.h"
-#include "lib/dcpomatic_log.h"
-#include "lib/dcpomatic_socket.h"
-#include "lib/dkdm_wrapper.h"
-#include "lib/emailer.h"
-#include "lib/encode_server_finder.h"
-#include "lib/exceptions.h"
-#include "lib/ffmpeg_encoder.h"
-#include "lib/film.h"
-#include "lib/hints.h"
-#include "lib/job_manager.h"
-#include "lib/kdm_with_metadata.h"
-#include "lib/log.h"
-#include "lib/make_dcp.h"
-#include "lib/release_notes.h"
-#include "lib/screen.h"
-#include "lib/send_kdm_email_job.h"
-#include "lib/signal_manager.h"
-#include "lib/subtitle_encoder.h"
-#include "lib/text_content.h"
-#include "lib/transcode_job.h"
-#include "lib/update_checker.h"
-#include "lib/util.h"
-#include "lib/version.h"
-#include "lib/video_content.h"
-#include <dcp/exceptions.h>
-#include <dcp/raw_convert.h>
-#include <dcp/warnings.h>
-LIBDCP_DISABLE_WARNINGS
-#include <wx/cmdline.h>
-#include <wx/generic/aboutdlgg.h>
-#include <wx/preferences.h>
-#include <wx/splash.h>
-#include <wx/stdpaths.h>
-#include <wx/wxhtml.h>
-LIBDCP_ENABLE_WARNINGS
-#ifdef __WXGTK__
-#include <X11/Xlib.h>
-#endif
-#ifdef __WXMSW__
-#include <shellapi.h>
-#endif
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-#include <iostream>
-#include <fstream>
-/* This is OK as it's only used with DCPOMATIC_WINDOWS */
-#include <sstream>
-
-#ifdef check
-#undef check
-#endif
-
-
-using std::cout;
-using std::dynamic_pointer_cast;
-using std::exception;
-using std::function;
-using std::list;
-using std::make_pair;
-using std::make_shared;
-using std::map;
-using std::shared_ptr;
-using std::string;
-using std::vector;
-using std::wcout;
-using boost::optional;
-using boost::is_any_of;
-using boost::algorithm::find;
-#if BOOST_VERSION >= 106100
-using namespace boost::placeholders;
-#endif
-using dcp::raw_convert;
-
-
-class FilmChangedClosingDialog
-{
-public:
-       explicit FilmChangedClosingDialog (string name)
-       {
-               _dialog = new wxMessageDialog (
-                       nullptr,
-                       wxString::Format(_("Save changes to film \"%s\" before closing?"), std_to_wx (name).data()),
-                       /// TRANSLATORS: this is the heading for a dialog box, which tells the user that the current
-                       /// project (Film) has been changed since it was last saved.
-                       _("Film changed"),
-                       wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_QUESTION
-                       );
-
-               _dialog->SetYesNoCancelLabels (
-                       _("Save film and close"), _("Close without saving film"), _("Don't close")
-                       );
-       }
-
-       ~FilmChangedClosingDialog ()
-       {
-               _dialog->Destroy ();
-       }
-
-       FilmChangedClosingDialog (FilmChangedClosingDialog const&) = delete;
-       FilmChangedClosingDialog& operator= (FilmChangedClosingDialog const&) = delete;
-
-       int run ()
-       {
-               return _dialog->ShowModal ();
-       }
-
-private:
-       wxMessageDialog* _dialog;
-};
-
-
-class FilmChangedDuplicatingDialog
-{
-public:
-       explicit FilmChangedDuplicatingDialog (string name)
-       {
-               _dialog = new wxMessageDialog (
-                       nullptr,
-                       wxString::Format(_("Save changes to film \"%s\" before duplicating?"), std_to_wx (name).data()),
-                       /// TRANSLATORS: this is the heading for a dialog box, which tells the user that the current
-                       /// project (Film) has been changed since it was last saved.
-                       _("Film changed"),
-                       wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_QUESTION
-                       );
-
-               _dialog->SetYesNoCancelLabels (
-                       _("Save film and duplicate"), _("Duplicate without saving film"), _("Don't duplicate")
-                       );
-       }
-
-       ~FilmChangedDuplicatingDialog ()
-       {
-               _dialog->Destroy ();
-       }
-
-       FilmChangedDuplicatingDialog (FilmChangedDuplicatingDialog const&) = delete;
-       FilmChangedDuplicatingDialog& operator= (FilmChangedDuplicatingDialog const&) = delete;
-
-       int run ()
-       {
-               return _dialog->ShowModal ();
-       }
-
-private:
-       wxMessageDialog* _dialog;
-};
-
+#include <wx/wx.h>
 
 class DOMFrame : public wxFrame
 {
@@ -224,28 +14,20 @@ public:
                auto overall_panel = new wxPanel (this, wxID_ANY);
 
                _film_viewer.reset (new FilmViewer (overall_panel));
-               _film_editor = new FilmEditor (overall_panel, _film_viewer);
 
                auto right_sizer = new wxBoxSizer (wxVERTICAL);
                right_sizer->Add (_film_viewer->panel(), 2, wxEXPAND | wxALL, 6);
 
                wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
-               main_sizer->Add (_film_editor, 0, wxEXPAND | wxALL, 6);
                main_sizer->Add (right_sizer, 1, wxEXPAND | wxALL, 6);
 
                overall_panel->SetSizer (main_sizer);
        }
 
-
-       shared_ptr<Film> film () const {
-               return _film;
-       }
-
 private:
 
        FilmEditor* _film_editor;
        std::shared_ptr<FilmViewer> _film_viewer;
-       shared_ptr<Film> _film;
 };
 
 
@@ -254,143 +36,23 @@ private:
  */
 class App : public wxApp
 {
-public:
-       App ()
-               : wxApp ()
-       {
-#ifdef DCPOMATIC_LINUX
-               XInitThreads ();
-#endif
-       }
-
 private:
 
        bool OnInit () override
        {
-               try {
-                       wxInitAllImageHandlers ();
-
-                       SetAppName (_("DCP-o-matic"));
-
-                       if (!wxApp::OnInit()) {
-                               return false;
-                       }
-
-#ifdef DCPOMATIC_LINUX
-                       unsetenv ("UBUNTU_MENUPROXY");
-#endif
-
-#ifdef DCPOMATIC_OSX
-                       dcpomatic_sleep_seconds (1);
-                       make_foreground_application ();
-#endif
-
-                       dcpomatic_setup_path_encoding ();
-
-                       /* Enable i18n; this will create a Config object
-                          to look for a force-configured language.  This Config
-                          object will be wrong, however, because dcpomatic_setup
-                          hasn't yet been called and there aren't any filters etc.
-                          set up yet.
-                       */
-                       dcpomatic_setup_i18n ();
-
-                       /* Set things up, including filters etc.
-                          which will now be internationalised correctly.
-                       */
-                       dcpomatic_setup ();
-
-                       /* Force the configuration to be re-loaded correctly next
-                          time it is needed.
-                       */
-                       Config::drop ();
-
-                       _frame = new DOMFrame (_("DCP-o-matic"));
-                       SetTopWindow (_frame);
-                       _frame->Maximize ();
-
-                       _frame->Show ();
-
-                       signal_manager = new wxSignalManager (this);
-                       Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1));
-
-                       _timer.reset (new wxTimer (this));
-                       _timer->Start (1000);
-               }
-               catch (exception& e)
-               {
-                       if (_splash) {
-                               _splash->Destroy ();
-                               _splash = nullptr;
-                       }
-                       error_dialog (nullptr, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
-               }
-
-               return true;
-       }
-
-       void report_exception ()
-       {
-               try {
-                       throw;
-               } catch (FileError& e) {
-                       error_dialog (
-                               nullptr,
-                               wxString::Format(
-                                       _("An exception occurred: %s (%s)\n\n") + REPORT_PROBLEM,
-                                       std_to_wx (e.what()),
-                                       std_to_wx (e.file().string().c_str())
-                                       )
-                               );
-               } catch (boost::filesystem::filesystem_error& e) {
-                       error_dialog (
-                               nullptr,
-                               wxString::Format(
-                                       _("An exception occurred: %s (%s) (%s)\n\n") + REPORT_PROBLEM,
-                                       std_to_wx (e.what()),
-                                       std_to_wx (e.path1().string()),
-                                       std_to_wx (e.path2().string())
-                                       )
-                               );
-               } catch (exception& e) {
-                       error_dialog (
-                               nullptr,
-                               wxString::Format(
-                                       _("An exception occurred: %s.\n\n") + REPORT_PROBLEM,
-                                       std_to_wx (e.what ())
-                                       )
-                               );
-               } catch (...) {
-                       error_dialog (0, _("An unknown exception occurred.") + "  " + REPORT_PROBLEM);
+               if (!wxApp::OnInit()) {
+                       return false;
                }
-       }
-
-       /* An unhandled exception has occurred inside the main event loop */
-       bool OnExceptionInMainLoop () override
-       {
-               report_exception ();
-               /* This will terminate the program */
-               return false;
-       }
 
-       void OnUnhandledException () override
-       {
-               report_exception ();
-       }
+               _frame = new DOMFrame (_("DCP-o-matic"));
+               SetTopWindow (_frame);
+               _frame->Maximize ();
+               _frame->Show ();
 
-       void idle (wxIdleEvent& ev)
-       {
-               signal_manager->ui_idle ();
-               ev.Skip ();
+               return true;
        }
 
        DOMFrame* _frame = nullptr;
-       wxSplashScreen* _splash = nullptr;
-       shared_ptr<wxTimer> _timer;
-       string _film_to_load;
-       string _film_to_create;
-       string _content_to_add;
-       string _dcp_to_add;
 };
 
 
index 8a3e57304e91233ca6e540ebbfdce8a6180be3ef..2ce2813d4249fae270641110dd6adbe9037bbdf6 100644 (file)
@@ -125,9 +125,6 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
        _notebook = new wxNotebook (_panel, wxID_ANY);
        _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
 
-       _notebook->AddPage (make_video_panel (), _("Video"), false);
-       _notebook->AddPage (make_audio_panel (), _("Audio"), false);
-
        _name->Bind                  (wxEVT_TEXT,     boost::bind(&DCPPanel::name_changed, this));
        _use_isdcf_name->Bind        (wxEVT_CHECKBOX, boost::bind(&DCPPanel::use_isdcf_name_toggled, this));
        _copy_isdcf_name_button->Bind(wxEVT_BUTTON,   boost::bind(&DCPPanel::copy_isdcf_name_button_clicked, this));
@@ -468,7 +465,6 @@ DCPPanel::film_changed (Film::Property p)
                break;
        case Film::Property::CONTENT:
                setup_dcp_name ();
-               setup_sensitivity ();
                break;
        case Film::Property::AUDIO_LANGUAGE:
        {
@@ -476,7 +472,6 @@ DCPPanel::film_changed (Film::Property p)
                checked_set (_enable_audio_language, static_cast<bool>(al));
                checked_set (_audio_language, al ? std_to_wx(al->to_string()) : wxT(""));
                setup_dcp_name ();
-               setup_sensitivity ();
                break;
        }
        case Film::Property::AUDIO_FRAME_RATE:
@@ -520,7 +515,6 @@ DCPPanel::film_content_changed (int property)
            property == DCPContentProperty::REFERENCE_AUDIO ||
            property == DCPContentProperty::REFERENCE_TEXT) {
                setup_dcp_name ();
-               setup_sensitivity ();
        }
 }
 
@@ -639,54 +633,8 @@ void
 DCPPanel::set_general_sensitivity (bool s)
 {
        _generally_sensitive = s;
-       setup_sensitivity ();
-}
-
-
-void
-DCPPanel::setup_sensitivity ()
-{
-       _name->Enable                   (_generally_sensitive);
-       _use_isdcf_name->Enable         (_generally_sensitive);
-       _dcp_content_type->Enable       (_generally_sensitive);
-       _copy_isdcf_name_button->Enable (_generally_sensitive);
-       _enable_audio_language->Enable  (_generally_sensitive);
-       _audio_language->Enable         (_enable_audio_language->GetValue());
-       _edit_audio_language->Enable    (_enable_audio_language->GetValue());
-       _encrypted->Enable              (_generally_sensitive);
-       _reel_type->Enable              (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
-       _reel_length->Enable            (_generally_sensitive && _film && _film->reel_type() == ReelType::BY_LENGTH);
-       _markers->Enable                (_generally_sensitive && _film && !_film->interop());
-       _metadata->Enable               (_generally_sensitive);
-       _frame_rate_choice->Enable      (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->contains_atmos_content());
-       _frame_rate_spin->Enable        (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->contains_atmos_content());
-       _audio_channels->Enable         (_generally_sensitive && _film && !_film->references_dcp_audio() && !_film->contains_atmos_content());
-       _audio_processor->Enable        (_generally_sensitive && _film && !_film->references_dcp_audio());
-       _j2k_bandwidth->Enable          (_generally_sensitive && _film && !_film->references_dcp_video());
-       _container->Enable              (_generally_sensitive && _film && !_film->references_dcp_video());
-       _best_frame_rate->Enable (
-               _generally_sensitive &&
-               _film &&
-               _film->best_video_frame_rate () != _film->video_frame_rate() &&
-               !_film->references_dcp_video() &&
-               !_film->contains_atmos_content()
-               );
-       _resolution->Enable             (_generally_sensitive && _film && !_film->references_dcp_video());
-       _three_d->Enable                (_generally_sensitive && _film && !_film->references_dcp_video());
-
-       _standard->Enable (
-               _generally_sensitive &&
-               _film &&
-               !_film->references_dcp_video() &&
-               !_film->references_dcp_audio() &&
-               !_film->contains_atmos_content()
-               );
-
-       _reencode_j2k->Enable           (_generally_sensitive && _film);
-       _show_audio->Enable             (_generally_sensitive && _film);
 }
 
-
 void
 DCPPanel::use_isdcf_name_toggled ()
 {
@@ -1024,7 +972,6 @@ DCPPanel::add_audio_processors ()
 void
 DCPPanel::enable_audio_language_toggled ()
 {
-       setup_sensitivity ();
        if (_enable_audio_language->GetValue()) {
                auto al = wx_to_std (_audio_language->GetLabel());
                _film->set_audio_language (al.empty() ? dcp::LanguageTag("en-US") : dcp::LanguageTag(al));
index 37bc20aa39f68b25a6b085fe5e7559a3a022819b..7fb997012fc33e9cfcde66263b51623371c43530 100644 (file)
@@ -106,8 +106,6 @@ private:
 
        void config_changed (Config::Property p);
 
-       void setup_sensitivity ();
-
        wxPanel* _panel;
        wxNotebook* _notebook;
        wxBoxSizer* _sizer;
index 2ec174260154158bc02c871ef6427cf21cc8200f..be14c306010b3c5f514ed44c7814a52a2227a373 100644 (file)
@@ -25,7 +25,6 @@
 
 
 #include "content_panel.h"
-#include "dcp_panel.h"
 #include "film_editor.h"
 #include "wx_util.h"
 #include "lib/content.h"
@@ -59,8 +58,6 @@ FilmEditor::FilmEditor (wxWindow* parent, weak_ptr<FilmViewer> viewer)
 
        _content_panel = new ContentPanel (_main_notebook, _film, viewer);
        _main_notebook->AddPage (_content_panel->window(), _("Content"), true);
-       _dcp_panel = new DCPPanel (_main_notebook, _film, viewer);
-       _main_notebook->AddPage (_dcp_panel->panel (), _("DCP"), false);
 
        JobManager::instance()->ActiveJobsChanged.connect (
                bind(&FilmEditor::active_jobs_changed, this, _2)
@@ -89,7 +86,6 @@ FilmEditor::film_change (ChangeType type, Film::Property p)
        }
 
        _content_panel->film_changed (p);
-       _dcp_panel->film_changed (p);
 
        if (p == Film::Property::CONTENT && !_film->content().empty()) {
                /* Select newly-added content */
@@ -115,7 +111,6 @@ FilmEditor::film_content_change (ChangeType type, int property)
        }
 
        _content_panel->film_content_changed (property);
-       _dcp_panel->film_content_changed (property);
 }
 
 
@@ -132,7 +127,6 @@ FilmEditor::set_film (shared_ptr<Film> film)
        _film = film;
 
        _content_panel->set_film (_film);
-       _dcp_panel->set_film (_film);
 
        if (!_film) {
                return;
@@ -151,7 +145,6 @@ void
 FilmEditor::set_general_sensitivity (bool s)
 {
        _content_panel->set_general_sensitivity (s);
-       _dcp_panel->set_general_sensitivity (s);
 }
 
 
index 0ba021b62eafed6ca8ebb4db07c6dfa5e55bdb2c..9aae1facf464702fa436ee916d12b30efb5eb0ee 100644 (file)
@@ -73,7 +73,6 @@ private:
 
        wxNotebook* _main_notebook;
        ContentPanel* _content_panel;
-       DCPPanel* _dcp_panel;
 
        /** The film we are editing */
        std::shared_ptr<Film> _film;