+2016-06-13 c.hetherington <cth@carlh.net>
+
+ * Add button to move things to the start of reels (#798).
+
2016-06-08 Carl Hetherington <cth@carlh.net>
* Version 2.8.9 released.
--- /dev/null
+/*
+ Copyright (C) 2016 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 "move_to_dialog.h"
+#include "lib/film.h"
+#include <wx/spinctrl.h>
+#include <boost/foreach.hpp>
+
+using std::list;
+using boost::shared_ptr;
+using boost::optional;
+
+MoveToDialog::MoveToDialog (wxWindow* parent, optional<DCPTime> position, shared_ptr<const Film> film)
+ : TableDialog (parent, _("Move content"), 2, 0, true)
+ , _film (film)
+{
+ add (_("Start of reel"), true);
+ _reel = new wxSpinCtrl (this, wxID_ANY);
+ _reel->SetRange (1, film->reels().size());
+ add (_reel);
+
+ layout ();
+
+ if (position) {
+ int j = 0;
+ BOOST_FOREACH (DCPTimePeriod i, film->reels()) {
+ if (i.from == position.get()) {
+ _reel->SetValue (j + 1);
+ }
+ ++j;
+ }
+ }
+}
+
+DCPTime
+MoveToDialog::position () const
+{
+ shared_ptr<const Film> film = _film.lock ();
+ DCPOMATIC_ASSERT (film);
+ list<DCPTimePeriod> reels = film->reels ();
+ list<DCPTimePeriod>::const_iterator i = reels.begin ();
+ for (int j = 0; j < _reel->GetValue() - 1; ++j) {
+ DCPOMATIC_ASSERT (i != reels.end());
+ ++i;
+ }
+
+ DCPOMATIC_ASSERT (i != reels.end());
+ return i->from;
+}
--- /dev/null
+/*
+ Copyright (C) 2016 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 "lib/dcpomatic_time.h"
+#include <boost/weak_ptr.hpp>
+#include <boost/optional.hpp>
+
+class Film;
+class wxSpinCtrl;
+
+class MoveToDialog : public TableDialog
+{
+public:
+ MoveToDialog (wxWindow* parent, boost::optional<DCPTime> position, boost::shared_ptr<const Film> film);
+
+ DCPTime position () const;
+
+private:
+ boost::weak_ptr<const Film> _film;
+ wxSpinCtrl* _reel;
+};
#include "film_viewer.h"
#include "timecode.h"
#include "content_panel.h"
+#include "move_to_dialog.h"
#include "lib/content.h"
#include "lib/image_content.h"
#include "lib/raw_convert.h"
add_label_to_sizer (grid, this, _("Position"), true);
_position = new Timecode<DCPTime> (this);
grid->Add (_position);
+ _move_to_start_of_reel = new wxButton (this, wxID_ANY, _("Move to start of reel"));
+ grid->AddSpacer (0);
+ grid->Add (_move_to_start_of_reel);
add_label_to_sizer (grid, this, _("Full length"), true);
_full_length = new Timecode<DCPTime> (this);
grid->Add (_full_length);
grid->Add (t, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 6);
_position->Changed.connect (boost::bind (&TimingPanel::position_changed, this));
+ _move_to_start_of_reel->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&TimingPanel::move_to_start_of_reel_clicked, this));
_full_length->Changed.connect (boost::bind (&TimingPanel::full_length_changed, this));
_trim_start->Changed.connect (boost::bind (&TimingPanel::trim_start_changed, this));
_trim_start_to_playhead->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&TimingPanel::trim_start_to_playhead_clicked, this));
_trim_start_to_playhead->Enable (any_over_ph);
_trim_end_to_playhead->Enable (any_over_ph);
}
+
+void
+TimingPanel::move_to_start_of_reel_clicked ()
+{
+ /* Find common position of all selected content, if it exists */
+
+ optional<DCPTime> position;
+ BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
+ if (!position) {
+ position = i->position();
+ } else {
+ if (position.get() != i->position()) {
+ position.reset ();
+ break;
+ }
+ }
+ }
+
+ MoveToDialog* d = new MoveToDialog (this, position, _parent->film());
+
+ if (d->ShowModal() == wxID_OK) {
+ BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
+ i->set_position (d->position ());
+ }
+ }
+ d->Destroy ();
+}
private:
void position_changed ();
+ void move_to_start_of_reel_clicked ();
void full_length_changed ();
void trim_start_changed ();
void trim_start_to_playhead_clicked ();
FilmViewer* _viewer;
Timecode<DCPTime>* _position;
+ wxButton* _move_to_start_of_reel;
Timecode<DCPTime>* _full_length;
Timecode<ContentTime>* _trim_start;
wxButton* _trim_start_to_playhead;
kdm_timing_panel.cc
key_dialog.cc
make_chain_dialog.cc
+ move_to_dialog.cc
new_film_dialog.cc
repeat_dialog.cc
report_problem_dialog.cc
*/
-/** @file test/subtitle_write_test.cc
- * @brief Test writing DCPs with XML subtitles.
+/** @file test/srt_subtitle_test.cc
+ * @brief Test writing DCPs with subtitles from .srt.
*/
#include "lib/film.h"
silence_padding_test.cc
skip_frame_test.cc
srt_subtitle_test.cc
+ ssa_subtitle_test.cc
stream_test.cc
test.cc
threed_test.cc