summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/dcp_panel.cc60
-rw-r--r--src/wx/dcp_panel.h8
-rw-r--r--src/wx/timing_panel.cc39
-rw-r--r--src/wx/timing_panel.h6
-rw-r--r--src/wx/wx_util.cc45
-rw-r--r--src/wx/wx_util.h3
6 files changed, 118 insertions, 43 deletions
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index c4a14a58b..b2413e9bd 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -118,6 +118,16 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
_standard_label = create_label (_panel, _("Standard"), true);
_standard = new wxChoice (_panel, wxID_ANY);
+ _hmsf = hmsf_labels (_panel);
+
+ _head_label = create_label (_panel, _("Head"), true);
+ _head = new Timecode<dcpomatic::DCPTime> (_panel, true);
+ _head->SetToolTip (_("Amount of black, silent padding to add to the start of the DCP."));
+
+ _tail_label = create_label (_panel, _("Tail"), true);
+ _tail = new Timecode<dcpomatic::DCPTime> (_panel, true);
+ _tail->SetToolTip (_("Amount of black, silent padding to add to the end of the DCP."));
+
_upload_after_make_dcp = new CheckBox (_panel, _("Upload DCP to TMS after it is made"));
_markers = new Button (_panel, _("Markers..."));
@@ -140,6 +150,8 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
_reel_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::reel_type_changed, this));
_reel_length->Bind (wxEVT_SPINCTRL, boost::bind (&DCPPanel::reel_length_changed, this));
_standard->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::standard_changed, this));
+ _head->Changed.connect (boost::bind(&DCPPanel::head_changed, this));
+ _tail->Changed.connect (boost::bind(&DCPPanel::tail_changed, this));
_upload_after_make_dcp->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::upload_after_make_dcp_changed, this));
_markers->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::markers_clicked, this));
_metadata->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::metadata_clicked, this));
@@ -223,6 +235,11 @@ DCPPanel::add_to_grid ()
_reel_length_gb_label->Show (full);
_standard_label->Show (full);
_standard->Show (full);
+ _hmsf->Show (full);
+ _head_label->Show (full);
+ _head->Show (full);
+ _tail_label->Show (full);
+ _tail->Show (full);
_upload_after_make_dcp->Show (full);
_markers->Show (full);
_metadata->Show (full);
@@ -256,6 +273,17 @@ DCPPanel::add_to_grid ()
_grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
++r;
+ _grid->Add (_hmsf, wxGBPosition(r,1));
+ ++r;
+
+ add_label_to_sizer (_grid, _head_label, true, wxGBPosition(r, 0));
+ _grid->Add (_head, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+ ++r;
+
+ add_label_to_sizer (_grid, _tail_label, true, wxGBPosition(r, 0));
+ _grid->Add (_tail, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+ ++r;
+
_grid->Add (_upload_after_make_dcp, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
@@ -535,6 +563,12 @@ DCPPanel::film_changed (int p)
case Film::CONTENT:
setup_dcp_name ();
break;
+ case Film::HEAD:
+ _head->set (_film->head(), _film->video_frame_rate());
+ break;
+ case Film::TAIL:
+ _tail->set (_film->tail(), _film->video_frame_rate());
+ break;
default:
break;
}
@@ -656,6 +690,8 @@ DCPPanel::set_film (shared_ptr<Film> film)
film_changed (Film::REEL_LENGTH);
film_changed (Film::UPLOAD_AFTER_MAKE_DCP);
film_changed (Film::REENCODE_J2K);
+ film_changed (Film::HEAD);
+ film_changed (Film::TAIL);
set_general_sensitivity(static_cast<bool>(_film));
}
@@ -700,6 +736,8 @@ DCPPanel::setup_sensitivity ()
_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());
+ _head->Enable (_generally_sensitive);
+ _tail->Enable (_generally_sensitive);
_reencode_j2k->Enable (_generally_sensitive && _film);
_show_audio->Enable (_generally_sensitive && _film);
}
@@ -1053,3 +1091,25 @@ DCPPanel::add_audio_processors ()
}
_audio_panel_sizer->Layout();
}
+
+void
+DCPPanel::head_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_head (_head->get(_film->video_frame_rate()));
+}
+
+void
+DCPPanel::tail_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_tail (_tail->get(_film->video_frame_rate()));
+}
+
+
diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h
index 887ae7c77..a50a473e9 100644
--- a/src/wx/dcp_panel.h
+++ b/src/wx/dcp_panel.h
@@ -19,6 +19,7 @@
*/
#include "lib/config.h"
+#include "timecode.h"
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
@@ -83,6 +84,8 @@ private:
void markers_clicked ();
void metadata_clicked ();
void reencode_j2k_changed ();
+ void head_changed ();
+ void tail_changed ();
void setup_frame_rate_widget ();
void setup_container ();
@@ -139,6 +142,11 @@ private:
wxChoice* _resolution;
wxStaticText* _standard_label;
wxChoice* _standard;
+ wxSizer* _hmsf;
+ wxStaticText* _head_label;
+ Timecode<dcpomatic::DCPTime>* _head;
+ wxStaticText* _tail_label;
+ Timecode<dcpomatic::DCPTime>* _tail;
wxCheckBox* _signed;
wxCheckBox* _encrypted;
wxStaticText* _key_label;
diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc
index 184356a20..ca5529517 100644
--- a/src/wx/timing_panel.cc
+++ b/src/wx/timing_panel.cc
@@ -57,34 +57,6 @@ TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer)
, _viewer (viewer)
, _film_content_changed_suspender (boost::bind(&TimingPanel::film_content_changed, this, _1))
{
- wxSize size = TimecodeBase::size (this);
-
- for (int i = 0; i < 3; ++i) {
- _colon[i] = create_label (this, wxT(":"), false);
- }
-
- //// TRANSLATORS: this is an abbreviation for "hours"
- _h_label = new StaticText (this, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
-#ifdef DCPOMATIC_LINUX
- /* Hack to work around failure to centre text on GTK */
- gtk_label_set_line_wrap (GTK_LABEL(_h_label->GetHandle()), FALSE);
-#endif
- //// TRANSLATORS: this is an abbreviation for "minutes"
- _m_label = new StaticText (this, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
-#ifdef DCPOMATIC_LINUX
- gtk_label_set_line_wrap (GTK_LABEL (_m_label->GetHandle()), FALSE);
-#endif
- //// TRANSLATORS: this is an abbreviation for "seconds"
- _s_label = new StaticText (this, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
-#ifdef DCPOMATIC_LINUX
- gtk_label_set_line_wrap (GTK_LABEL(_s_label->GetHandle()), FALSE);
-#endif
- //// TRANSLATORS: this is an abbreviation for "frames"
- _f_label = new StaticText (this, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
-#ifdef DCPOMATIC_LINUX
- gtk_label_set_line_wrap (GTK_LABEL(_f_label->GetHandle()), FALSE);
-#endif
-
_position_label = create_label (this, _("Position"), true);
_position = new Timecode<DCPTime> (this);
_move_to_start_of_reel = new Button (this, _("Move to start of reel"));
@@ -98,6 +70,7 @@ TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer)
_trim_end_to_playhead = new Button (this, _("Trim after current position"));
_play_length_label = create_label (this, _("Play length"), true);
_play_length = new Timecode<DCPTime> (this);
+ _hmsf_labels = hmsf_labels(this);
_video_frame_rate_label = create_label (this, _("Video frame rate"), true);
_video_frame_rate = new wxTextCtrl (this, wxID_ANY);
@@ -155,15 +128,7 @@ TimingPanel::add_to_grid ()
int r = 0;
- wxSizer* labels = new wxBoxSizer (wxHORIZONTAL);
- labels->Add (_h_label, 1, wxEXPAND);
- add_label_to_sizer (labels, _colon[0], false);
- labels->Add (_m_label, 1, wxEXPAND);
- add_label_to_sizer (labels, _colon[1], false);
- labels->Add (_s_label, 1, wxEXPAND);
- add_label_to_sizer (labels, _colon[2], false);
- labels->Add (_f_label, 1, wxEXPAND);
- _grid->Add (labels, wxGBPosition(r, 1));
+ _grid->Add (_hmsf_labels, wxGBPosition(r, 1));
++r;
add_label_to_sizer (_grid, _position_label, true, wxGBPosition(r, 0));
diff --git a/src/wx/timing_panel.h b/src/wx/timing_panel.h
index e0be2d74b..7b632976a 100644
--- a/src/wx/timing_panel.h
+++ b/src/wx/timing_panel.h
@@ -51,11 +51,6 @@ private:
boost::weak_ptr<FilmViewer> _viewer;
- wxStaticText* _h_label;
- wxStaticText* _m_label;
- wxStaticText* _s_label;
- wxStaticText* _f_label;
- wxStaticText* _colon[3];
wxStaticText* _tip;
wxStaticText* _position_label;
Timecode<dcpomatic::DCPTime>* _position;
@@ -75,4 +70,5 @@ private:
wxButton* _set_video_frame_rate;
Suspender _film_content_changed_suspender;
+ wxSizer* _hmsf_labels;
};
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 28f79431a..6f63f91bc 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -530,3 +530,48 @@ display_progress (wxString title, wxString task)
return ok;
}
+
+wxSizer*
+hmsf_labels (wxWindow* parent)
+{
+ wxClientDC dc (parent);
+ wxSize size = dc.GetTextExtent (wxT("9999"));
+ size.SetHeight (-1);
+
+ wxStaticText* colon[3];
+ for (int i = 0; i < 3; ++i) {
+ colon[i] = create_label (parent, wxT(":"), false);
+ }
+
+ wxStaticText* h_label = new StaticText (parent, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
+#ifdef DCPOMATIC_LINUX
+ /* Hack to work around failure to centre text on GTK */
+ gtk_label_set_line_wrap (GTK_LABEL(h_label->GetHandle()), FALSE);
+#endif
+ //// TRANSLATORS: this is an abbreviation for "minutes"
+ wxStaticText* m_label = new StaticText (parent, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
+#ifdef DCPOMATIC_LINUX
+ gtk_label_set_line_wrap (GTK_LABEL (m_label->GetHandle()), FALSE);
+#endif
+ //// TRANSLATORS: this is an abbreviation for "seconds"
+ wxStaticText* s_label = new StaticText (parent, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
+#ifdef DCPOMATIC_LINUX
+ gtk_label_set_line_wrap (GTK_LABEL(s_label->GetHandle()), FALSE);
+#endif
+ //// TRANSLATORS: this is an abbreviation for "frames"
+ wxStaticText* f_label = new StaticText (parent, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
+#ifdef DCPOMATIC_LINUX
+ gtk_label_set_line_wrap (GTK_LABEL(f_label->GetHandle()), FALSE);
+#endif
+ wxSizer* labels = new wxBoxSizer (wxHORIZONTAL);
+ labels->Add (h_label, 1, wxEXPAND);
+ add_label_to_sizer (labels, colon[0], false);
+ labels->Add (m_label, 1, wxEXPAND);
+ add_label_to_sizer (labels, colon[1], false);
+ labels->Add (s_label, 1, wxEXPAND);
+ add_label_to_sizer (labels, colon[2], false);
+ labels->Add (f_label, 1, wxEXPAND);
+
+ return labels;
+}
+
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index 400493f18..6cf839cc3 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -90,6 +90,7 @@ extern wxSplashScreen* maybe_show_splash ();
extern double calculate_mark_interval (double start);
extern bool display_progress (wxString title, wxString task);
extern bool report_errors_from_last_job (wxWindow* parent);
+extern wxSizer* hmsf_labels (wxWindow* parent);
extern void checked_set (FilePickerCtrl* widget, boost::filesystem::path value);
extern void checked_set (wxDirPickerCtrl* widget, boost::filesystem::path value);