Split KDM output stuff into a separate panel.
authorCarl Hetherington <cth@carlh.net>
Tue, 6 Oct 2015 09:39:06 +0000 (10:39 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 9 Oct 2015 12:44:48 +0000 (13:44 +0100)
src/wx/kdm_dialog.cc
src/wx/kdm_dialog.h
src/wx/kdm_output_panel.cc [new file with mode: 0644]
src/wx/kdm_output_panel.h [new file with mode: 0644]
src/wx/wscript

index e9ad96b8d34f741c75436ab22436a161d30c95c3..50c3b6848929487637f00b9398c7b86e4ab8b4ad 100644 (file)
 #include "wx_util.h"
 #include "screens_panel.h"
 #include "kdm_timing_panel.h"
 #include "wx_util.h"
 #include "screens_panel.h"
 #include "kdm_timing_panel.h"
+#include "kdm_output_panel.h"
 #include "lib/cinema.h"
 #include "lib/config.h"
 #include "lib/film.h"
 #include "lib/screen.h"
 #include <libcxml/cxml.h>
 #include "lib/cinema.h"
 #include "lib/config.h"
 #include "lib/film.h"
 #include "lib/screen.h"
 #include <libcxml/cxml.h>
-#ifdef DCPOMATIC_USE_OWN_DIR_PICKER
-#include "dir_picker_ctrl.h"
-#else
-#include <wx/filepicker.h>
-#endif
 #include <wx/treectrl.h>
 #include <wx/treectrl.h>
-#include <wx/stdpaths.h>
 #include <wx/listctrl.h>
 #include <iostream>
 
 #include <wx/listctrl.h>
 #include <iostream>
 
@@ -101,42 +96,12 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film)
        _cpls = film->cpls ();
        update_cpl_choice ();
 
        _cpls = film->cpls ();
        update_cpl_choice ();
 
-
        /* Sub-heading: Output */
        h = new wxStaticText (this, wxID_ANY, _("Output"));
        h->SetFont (subheading_font);
        vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2);
        /* Sub-heading: Output */
        h = new wxStaticText (this, wxID_ANY, _("Output"));
        h->SetFont (subheading_font);
        vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2);
-
-       table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0);
-
-       add_label_to_sizer (table, this, _("KDM type"), true);
-       _type = new wxChoice (this, wxID_ANY);
-       _type->Append ("Modified Transitional 1", ((void *) dcp::MODIFIED_TRANSITIONAL_1));
-       if (!film->interop ()) {
-               _type->Append ("DCI Any", ((void *) dcp::DCI_ANY));
-               _type->Append ("DCI Specific", ((void *) dcp::DCI_SPECIFIC));
-       }
-       table->Add (_type, 1, wxEXPAND);
-       _type->SetSelection (0);
-
-       _write_to = new wxRadioButton (this, wxID_ANY, _("Write to"));
-       table->Add (_write_to, 1, wxEXPAND);
-
-#ifdef DCPOMATIC_USE_OWN_DIR_PICKER
-       _folder = new DirPickerCtrl (this);
-#else
-       _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1));
-#endif
-
-       _folder->SetPath (wxStandardPaths::Get().GetDocumentsDir());
-
-       table->Add (_folder, 1, wxEXPAND);
-
-       _email = new wxRadioButton (this, wxID_ANY, _("Send by email"));
-       table->Add (_email, 1, wxEXPAND);
-       table->AddSpacer (0);
-
-       vertical->Add (table, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP);
+       _output = new KDMOutputPanel (this, film->interop ());
+       vertical->Add (_output, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP);
 
        /* Make an overall sizer to get a nice border, and put some buttons in */
 
 
        /* Make an overall sizer to get a nice border, and put some buttons in */
 
@@ -148,8 +113,6 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film)
                overall_sizer->Add (buttons, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_Y_GAP);
        }
 
                overall_sizer->Add (buttons, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_Y_GAP);
        }
 
-       _write_to->SetValue (true);
-
        /* Bind */
 
        _screens->ScreensChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this));
        /* Bind */
 
        _screens->ScreensChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this));
@@ -157,9 +120,6 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film)
        _cpl->Bind           (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&KDMDialog::update_cpl_summary, this));
        _cpl_browse->Bind    (wxEVT_COMMAND_BUTTON_CLICKED,  boost::bind (&KDMDialog::cpl_browse_clicked, this));
 
        _cpl->Bind           (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&KDMDialog::update_cpl_summary, this));
        _cpl_browse->Bind    (wxEVT_COMMAND_BUTTON_CLICKED,  boost::bind (&KDMDialog::cpl_browse_clicked, this));
 
-       _write_to->Bind      (wxEVT_COMMAND_RADIOBUTTON_SELECTED, boost::bind (&KDMDialog::setup_sensitivity, this));
-       _email->Bind         (wxEVT_COMMAND_RADIOBUTTON_SELECTED, boost::bind (&KDMDialog::setup_sensitivity, this));
-
        setup_sensitivity ();
 
        SetSizer (overall_sizer);
        setup_sensitivity ();
 
        SetSizer (overall_sizer);
@@ -171,6 +131,7 @@ void
 KDMDialog::setup_sensitivity ()
 {
        _screens->setup_sensitivity ();
 KDMDialog::setup_sensitivity ()
 {
        _screens->setup_sensitivity ();
+       _output->setup_sensitivity ();
 
        bool const sd = _cpl->GetSelection() != -1;
 
 
        bool const sd = _cpl->GetSelection() != -1;
 
@@ -178,8 +139,6 @@ KDMDialog::setup_sensitivity ()
        if (ok) {
                ok->Enable (!_screens->screens().empty() && sd);
        }
        if (ok) {
                ok->Enable (!_screens->screens().empty() && sd);
        }
-
-       _folder->Enable (_write_to->GetValue ());
 }
 
 boost::filesystem::path
 }
 
 boost::filesystem::path
@@ -190,24 +149,6 @@ KDMDialog::cpl () const
        return _cpls[item].cpl_file;
 }
 
        return _cpls[item].cpl_file;
 }
 
-boost::filesystem::path
-KDMDialog::directory () const
-{
-       return wx_to_std (_folder->GetPath ());
-}
-
-bool
-KDMDialog::write_to () const
-{
-       return _write_to->GetValue ();
-}
-
-dcp::Formulation
-KDMDialog::formulation () const
-{
-       return (dcp::Formulation) reinterpret_cast<intptr_t> (_type->GetClientData (_type->GetSelection()));
-}
-
 void
 KDMDialog::update_cpl_choice ()
 {
 void
 KDMDialog::update_cpl_choice ()
 {
@@ -291,3 +232,21 @@ KDMDialog::until () const
 {
        return _timing->until ();
 }
 {
        return _timing->until ();
 }
+
+boost::filesystem::path
+KDMDialog::directory () const
+{
+       return _output->directory ();
+}
+
+bool
+KDMDialog::write_to () const
+{
+       return _output->write_to ();
+}
+
+dcp::Formulation
+KDMDialog::formulation () const
+{
+       return _output->formulation ();
+}
index 365d05a99672c2bd803904f7de4da56c7571ffbd..6400ebb6c807b8cba9cedf499c580b70540a4753 100644 (file)
 #include <map>
 
 class wxTreeCtrl;
 #include <map>
 
 class wxTreeCtrl;
-class wxDirPickerCtrl;
-class DirPickerCtrl;
 
 class Cinema;
 class Screen;
 class Film;
 class ScreensPanel;
 class KDMTimingPanel;
 
 class Cinema;
 class Screen;
 class Film;
 class ScreensPanel;
 class KDMTimingPanel;
+class KDMOutputPanel;
 struct CPLSummary;
 
 class KDMDialog : public wxDialog
 struct CPLSummary;
 
 class KDMDialog : public wxDialog
@@ -48,6 +47,7 @@ public:
        boost::posix_time::ptime until () const;
 
        boost::filesystem::path cpl () const;
        boost::posix_time::ptime until () const;
 
        boost::filesystem::path cpl () const;
+
        boost::filesystem::path directory () const;
        bool write_to () const;
        dcp::Formulation formulation () const;
        boost::filesystem::path directory () const;
        bool write_to () const;
        dcp::Formulation formulation () const;
@@ -60,19 +60,12 @@ private:
 
        ScreensPanel* _screens;
        KDMTimingPanel* _timing;
 
        ScreensPanel* _screens;
        KDMTimingPanel* _timing;
+       KDMOutputPanel* _output;
        wxChoice* _cpl;
        wxButton* _cpl_browse;
        wxStaticText* _dcp_directory;
        wxStaticText* _cpl_id;
        wxStaticText* _cpl_annotation_text;
        wxChoice* _cpl;
        wxButton* _cpl_browse;
        wxStaticText* _dcp_directory;
        wxStaticText* _cpl_id;
        wxStaticText* _cpl_annotation_text;
-       wxChoice* _type;
-       wxRadioButton* _write_to;
-#ifdef DCPOMATIC_USE_OWN_DIR_PICKER
-       DirPickerCtrl* _folder;
-#else
-       wxDirPickerCtrl* _folder;
-#endif
-       wxRadioButton* _email;
 
        std::vector<CPLSummary> _cpls;
 };
 
        std::vector<CPLSummary> _cpls;
 };
diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc
new file mode 100644 (file)
index 0000000..fd97d1c
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+    Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+
+    This program 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.
+
+    This program 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 this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "kdm_output_panel.h"
+#include "wx_util.h"
+#include <dcp/types.h>
+#ifdef DCPOMATIC_USE_OWN_DIR_PICKER
+#include "dir_picker_ctrl.h"
+#else
+#include <wx/filepicker.h>
+#endif
+#include <wx/stdpaths.h>
+
+KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
+       : wxPanel (parent, wxID_ANY)
+{
+       wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0);
+
+       add_label_to_sizer (table, this, _("KDM type"), true);
+       _type = new wxChoice (this, wxID_ANY);
+       _type->Append ("Modified Transitional 1", ((void *) dcp::MODIFIED_TRANSITIONAL_1));
+       if (!interop) {
+               _type->Append ("DCI Any", ((void *) dcp::DCI_ANY));
+               _type->Append ("DCI Specific", ((void *) dcp::DCI_SPECIFIC));
+       }
+       table->Add (_type, 1, wxEXPAND);
+       _type->SetSelection (0);
+
+       _write_to = new wxRadioButton (this, wxID_ANY, _("Write to"));
+       table->Add (_write_to, 1, wxEXPAND);
+
+#ifdef DCPOMATIC_USE_OWN_DIR_PICKER
+       _folder = new DirPickerCtrl (this);
+#else
+       _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1));
+#endif
+
+       _folder->SetPath (wxStandardPaths::Get().GetDocumentsDir());
+
+       table->Add (_folder, 1, wxEXPAND);
+
+       _email = new wxRadioButton (this, wxID_ANY, _("Send by email"));
+       table->Add (_email, 1, wxEXPAND);
+       table->AddSpacer (0);
+
+       _write_to->SetValue (true);
+
+       _write_to->Bind (wxEVT_COMMAND_RADIOBUTTON_SELECTED, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+       _email->Bind    (wxEVT_COMMAND_RADIOBUTTON_SELECTED, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+
+       SetSizer (table);
+}
+
+void
+KDMOutputPanel::setup_sensitivity ()
+{
+       _folder->Enable (_write_to->GetValue ());
+}
+
+boost::filesystem::path
+KDMOutputPanel::directory () const
+{
+       return wx_to_std (_folder->GetPath ());
+}
+
+bool
+KDMOutputPanel::write_to () const
+{
+       return _write_to->GetValue ();
+}
+
+dcp::Formulation
+KDMOutputPanel::formulation () const
+{
+       return (dcp::Formulation) reinterpret_cast<intptr_t> (_type->GetClientData (_type->GetSelection()));
+}
diff --git a/src/wx/kdm_output_panel.h b/src/wx/kdm_output_panel.h
new file mode 100644 (file)
index 0000000..d2423b6
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+    Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+
+    This program 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.
+
+    This program 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 this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <dcp/types.h>
+#include <wx/wx.h>
+#include <boost/filesystem.hpp>
+
+class wxDirPickerCtrl;
+class DirPickerCtrl;
+
+class KDMOutputPanel : public wxPanel
+{
+public:
+       KDMOutputPanel (wxWindow* parent, bool interop);
+
+       boost::filesystem::path directory () const;
+       bool write_to () const;
+       dcp::Formulation formulation () const;
+
+       void setup_sensitivity ();
+
+private:
+       wxChoice* _type;
+       wxRadioButton* _write_to;
+#ifdef DCPOMATIC_USE_OWN_DIR_PICKER
+       DirPickerCtrl* _folder;
+#else
+       wxDirPickerCtrl* _folder;
+#endif
+       wxRadioButton* _email;
+};
index 551ec20f99c0d092db397cf3cbca9b9e10386689..576b9231dae3fd0926dda93a8d8544501b9f2636 100644 (file)
@@ -54,6 +54,7 @@ sources = """
           hints_dialog.cc
           job_manager_view.cc
           kdm_dialog.cc
           hints_dialog.cc
           job_manager_view.cc
           kdm_dialog.cc
+          kdm_output_panel.cc
           kdm_timing_panel.cc
           key_dialog.cc
           make_chain_dialog.cc
           kdm_timing_panel.cc
           key_dialog.cc
           make_chain_dialog.cc