Build fixes for Boost >= 1.73
[dcpomatic.git] / src / wx / timing_panel.cc
1 /*
2     Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #include "timing_panel.h"
22 #include "wx_util.h"
23 #include "film_viewer.h"
24 #include "timecode.h"
25 #include "content_panel.h"
26 #include "move_to_dialog.h"
27 #include "static_text.h"
28 #include "dcpomatic_button.h"
29 #include "lib/content.h"
30 #include "lib/image_content.h"
31 #include "lib/text_content.h"
32 #include "lib/dcp_subtitle_content.h"
33 #include "lib/audio_content.h"
34 #include "lib/string_text_file_content.h"
35 #include "lib/video_content.h"
36 #include "lib/dcp_content.h"
37 #include "lib/ffmpeg_content.h"
38 #include <dcp/locale_convert.h>
39 #if defined(__WXGTK20__) && !defined(__WXGTK3__)
40 #define TIMING_PANEL_ALIGNMENT_HACK 1
41 #include <gtk/gtk.h>
42 #endif
43 #include <boost/foreach.hpp>
44 #include <set>
45 #include <iostream>
46
47 using std::cout;
48 using std::string;
49 using std::set;
50 using boost::shared_ptr;
51 using boost::weak_ptr;
52 using boost::dynamic_pointer_cast;
53 using boost::optional;
54 #if BOOST_VERSION >= 106100
55 using namespace boost::placeholders;
56 #endif
57 using dcp::locale_convert;
58
59 TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer)
60         /* horrid hack for apparent lack of context support with wxWidgets i18n code */
61         /// TRANSLATORS: translate the word "Timing" here; do not include the "Timing|" prefix
62         : ContentSubPanel (p, S_("Timing|Timing"))
63         , _viewer (viewer)
64         , _film_content_changed_suspender (boost::bind(&TimingPanel::film_content_changed, this, _1))
65 {
66         wxSize size = TimecodeBase::size (this);
67
68         for (int i = 0; i < 3; ++i) {
69                 _colon[i] = create_label (this, wxT(":"), false);
70         }
71
72         //// TRANSLATORS: this is an abbreviation for "hours"
73         _h_label = new StaticText (this, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
74 #ifdef TIMING_PANEL_ALIGNMENT_HACK
75         /* Hack to work around failure to centre text on GTK */
76         gtk_label_set_line_wrap (GTK_LABEL(_h_label->GetHandle()), FALSE);
77 #endif
78         //// TRANSLATORS: this is an abbreviation for "minutes"
79         _m_label = new StaticText (this, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
80 #ifdef TIMING_PANEL_ALIGNMENT_HACK
81         gtk_label_set_line_wrap (GTK_LABEL (_m_label->GetHandle()), FALSE);
82 #endif
83         //// TRANSLATORS: this is an abbreviation for "seconds"
84         _s_label = new StaticText (this, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
85 #ifdef TIMING_PANEL_ALIGNMENT_HACK
86         gtk_label_set_line_wrap (GTK_LABEL(_s_label->GetHandle()), FALSE);
87 #endif
88         //// TRANSLATORS: this is an abbreviation for "frames"
89         _f_label = new StaticText (this, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
90 #ifdef TIMING_PANEL_ALIGNMENT_HACK
91         gtk_label_set_line_wrap (GTK_LABEL(_f_label->GetHandle()), FALSE);
92 #endif
93
94         _position_label = create_label (this, _("Position"), true);
95         _position = new Timecode<DCPTime> (this);
96         _move_to_start_of_reel = new Button (this, _("Move to start of reel"));
97         _full_length_label = create_label (this, _("Full length"), true);
98         _full_length = new Timecode<DCPTime> (this);
99         _trim_start_label = create_label (this, _("Trim from start"), true);
100         _trim_start = new Timecode<ContentTime> (this);
101         _trim_start_to_playhead = new Button (this, _("Trim up to current position"));
102         _trim_end_label = create_label (this, _("Trim from end"), true);
103         _trim_end = new Timecode<ContentTime> (this);
104         _trim_end_to_playhead = new Button (this, _("Trim after current position"));
105         _play_length_label = create_label (this, _("Play length"), true);
106         _play_length = new Timecode<DCPTime> (this);
107
108         _video_frame_rate_label = create_label (this, _("Video frame rate"), true);
109         _video_frame_rate = new wxTextCtrl (this, wxID_ANY);
110         _set_video_frame_rate = new Button (this, _("Set"));
111         _set_video_frame_rate->Enable (false);
112
113         /* We can't use Wrap() here as it doesn't work with markup:
114          * http://trac.wxwidgets.org/ticket/13389
115          */
116
117         wxString in = _("<i>Only change this if the content's frame rate has been read incorrectly.</i>");
118         wxString out;
119         int const width = 20;
120         int current = 0;
121         for (size_t i = 0; i < in.Length(); ++i) {
122                 if (in[i] == ' ' && current >= width) {
123                         out += '\n';
124                         current = 0;
125                 } else {
126                         out += in[i];
127                         ++current;
128                 }
129         }
130
131         _tip = new StaticText (this, wxT (""));
132         _tip->SetLabelMarkup (out);
133 #ifdef DCPOMATIC_OSX
134         /* Hack to stop hidden text on some versions of OS X */
135         _tip->SetMinSize (wxSize (-1, 256));
136 #endif
137
138         _position->Changed.connect    (boost::bind (&TimingPanel::position_changed, this));
139         _move_to_start_of_reel->Bind  (wxEVT_BUTTON, boost::bind (&TimingPanel::move_to_start_of_reel_clicked, this));
140         _full_length->Changed.connect (boost::bind (&TimingPanel::full_length_changed, this));
141         _trim_start->Changed.connect  (boost::bind (&TimingPanel::trim_start_changed, this));
142         _trim_start_to_playhead->Bind (wxEVT_BUTTON, boost::bind (&TimingPanel::trim_start_to_playhead_clicked, this));
143         _trim_end->Changed.connect    (boost::bind (&TimingPanel::trim_end_changed, this));
144         _trim_end_to_playhead->Bind   (wxEVT_BUTTON, boost::bind (&TimingPanel::trim_end_to_playhead_clicked, this));
145         _play_length->Changed.connect (boost::bind (&TimingPanel::play_length_changed, this));
146         _video_frame_rate->Bind       (wxEVT_TEXT, boost::bind (&TimingPanel::video_frame_rate_changed, this));
147         _set_video_frame_rate->Bind   (wxEVT_BUTTON, boost::bind (&TimingPanel::set_video_frame_rate, this));
148
149         shared_ptr<FilmViewer> fv = _viewer.lock ();
150         DCPOMATIC_ASSERT (fv);
151         fv->ImageChanged.connect (boost::bind (&TimingPanel::setup_sensitivity, this));
152
153         setup_sensitivity ();
154         add_to_grid ();
155 }
156
157 void
158 TimingPanel::add_to_grid ()
159 {
160         bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
161
162         int r = 0;
163
164         wxSizer* labels = new wxBoxSizer (wxHORIZONTAL);
165         labels->Add (_h_label, 1, wxEXPAND);
166         add_label_to_sizer (labels, _colon[0], false);
167         labels->Add (_m_label, 1, wxEXPAND);
168         add_label_to_sizer (labels, _colon[1], false);
169         labels->Add (_s_label, 1, wxEXPAND);
170         add_label_to_sizer (labels, _colon[2], false);
171         labels->Add (_f_label, 1, wxEXPAND);
172         _grid->Add (labels, wxGBPosition(r, 1));
173         ++r;
174
175         add_label_to_sizer (_grid, _position_label, true, wxGBPosition(r, 0));
176         _grid->Add (_position, wxGBPosition(r, 1));
177         ++r;
178
179         _move_to_start_of_reel->Show (full);
180         _full_length_label->Show (full);
181         _full_length->Show (full);
182         _play_length_label->Show (full);
183         _play_length->Show (full);
184         _video_frame_rate_label->Show (full);
185         _video_frame_rate->Show (full);
186         _set_video_frame_rate->Show (full);
187         _tip->Show (full);
188
189         if (full) {
190                 _grid->Add (_move_to_start_of_reel, wxGBPosition(r, 1));
191                 ++r;
192
193                 add_label_to_sizer (_grid, _full_length_label, true, wxGBPosition(r, 0));
194                 _grid->Add (_full_length, wxGBPosition(r, 1));
195                 ++r;
196         }
197
198         add_label_to_sizer (_grid, _trim_start_label, true, wxGBPosition(r, 0));
199         _grid->Add (_trim_start, wxGBPosition(r, 1));
200         ++r;
201
202         _grid->Add (_trim_start_to_playhead, wxGBPosition(r, 1));
203         ++r;
204
205         add_label_to_sizer (_grid, _trim_end_label, true, wxGBPosition(r, 0));
206         _grid->Add (_trim_end, wxGBPosition(r, 1));
207         ++r;
208
209         _grid->Add (_trim_end_to_playhead, wxGBPosition(r, 1));
210         ++r;
211
212         if (full) {
213                 add_label_to_sizer (_grid, _play_length_label, true, wxGBPosition(r, 0));
214                 _grid->Add (_play_length, wxGBPosition(r, 1));
215                 ++r;
216
217                 {
218                         add_label_to_sizer (_grid, _video_frame_rate_label, true, wxGBPosition(r, 0));
219                         wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
220                         s->Add (_video_frame_rate, 1, wxEXPAND);
221                         s->Add (_set_video_frame_rate, 0, wxLEFT | wxRIGHT, 8);
222                         _grid->Add (s, wxGBPosition(r, 1), wxGBSpan(1, 2));
223                 }
224                 ++r;
225
226                 _grid->Add (_tip, wxGBPosition(r, 1), wxGBSpan(1, 2));
227         }
228
229         /* Completely speculative fix for #891 */
230         _grid->Layout ();
231 }
232
233 void
234 TimingPanel::update_full_length ()
235 {
236         set<DCPTime> check;
237         BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
238                 check.insert (i->full_length(_parent->film()));
239         }
240
241         if (check.size() == 1) {
242                 _full_length->set (_parent->selected().front()->full_length(_parent->film()), _parent->film()->video_frame_rate());
243         } else {
244                 _full_length->clear ();
245         }
246 }
247
248 void
249 TimingPanel::update_play_length ()
250 {
251         set<DCPTime> check;
252         BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
253                 check.insert (i->length_after_trim(_parent->film()));
254         }
255
256         if (check.size() == 1) {
257                 _play_length->set (_parent->selected().front()->length_after_trim(_parent->film()), _parent->film()->video_frame_rate());
258         } else {
259                 _play_length->clear ();
260         }
261 }
262
263 void
264 TimingPanel::film_content_changed (int property)
265 {
266         if (_film_content_changed_suspender.check(property)) {
267                 return;
268         }
269
270         int const film_video_frame_rate = _parent->film()->video_frame_rate ();
271
272         /* Here we check to see if we have exactly one different value of various
273            properties, and fill the controls with that value if so.
274         */
275
276         if (property == ContentProperty::POSITION) {
277
278                 set<DCPTime> check;
279                 BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
280                         check.insert (i->position ());
281                 }
282
283                 if (check.size() == 1) {
284                         _position->set (_parent->selected().front()->position(), film_video_frame_rate);
285                 } else {
286                         _position->clear ();
287                 }
288
289         } else if (
290                 property == ContentProperty::LENGTH ||
291                 property == ContentProperty::VIDEO_FRAME_RATE ||
292                 property == VideoContentProperty::FRAME_TYPE
293                 ) {
294
295                 update_full_length ();
296
297         } else if (property == ContentProperty::TRIM_START) {
298
299                 set<ContentTime> check;
300                 BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
301                         check.insert (i->trim_start ());
302                 }
303
304                 if (check.size() == 1) {
305                         _trim_start->set (_parent->selected().front()->trim_start (), film_video_frame_rate);
306                 } else {
307                         _trim_start->clear ();
308                 }
309
310         } else if (property == ContentProperty::TRIM_END) {
311
312                 set<ContentTime> check;
313                 BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
314                         check.insert (i->trim_end ());
315                 }
316
317                 if (check.size() == 1) {
318                         _trim_end->set (_parent->selected().front()->trim_end (), film_video_frame_rate);
319                 } else {
320                         _trim_end->clear ();
321                 }
322         }
323
324         if (
325                 property == ContentProperty::LENGTH ||
326                 property == ContentProperty::TRIM_START ||
327                 property == ContentProperty::TRIM_END ||
328                 property == ContentProperty::VIDEO_FRAME_RATE ||
329                 property == VideoContentProperty::FRAME_TYPE
330                 ) {
331
332                 update_play_length ();
333         }
334
335         if (property == ContentProperty::VIDEO_FRAME_RATE) {
336                 set<double> check_vc;
337                 shared_ptr<const Content> content;
338                 int count_ac = 0;
339                 int count_sc = 0;
340                 BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
341                         if (i->video && i->video_frame_rate()) {
342                                 check_vc.insert (i->video_frame_rate().get());
343                                 content = i;
344                         }
345                         if (i->audio && i->video_frame_rate()) {
346                                 ++count_ac;
347                                 content = i;
348                         }
349                         if (!i->text.empty() && i->video_frame_rate()) {
350                                 ++count_sc;
351                                 content = i;
352                         }
353
354                 }
355
356                 bool const single_frame_image_content = content && dynamic_pointer_cast<const ImageContent> (content) && content->number_of_paths() == 1;
357
358                 if ((check_vc.size() == 1 || count_ac == 1 || count_sc == 1) && !single_frame_image_content) {
359                         checked_set (_video_frame_rate, locale_convert<string> (content->video_frame_rate().get(), 5));
360                         _video_frame_rate->Enable (true);
361                 } else {
362                         checked_set (_video_frame_rate, wxT (""));
363                         _video_frame_rate->Enable (false);
364                 }
365         }
366
367         bool have_still = false;
368         BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
369                 shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (i);
370                 if (ic && ic->still ()) {
371                         have_still = true;
372                 }
373         }
374
375         _full_length->set_editable (have_still);
376         _play_length->set_editable (!have_still);
377         _set_video_frame_rate->Enable (false);
378         setup_sensitivity ();
379 }
380
381 void
382 TimingPanel::position_changed ()
383 {
384         DCPTime const pos = _position->get (_parent->film()->video_frame_rate ());
385         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
386                 i->set_position (_parent->film(), pos);
387         }
388 }
389
390 void
391 TimingPanel::full_length_changed ()
392 {
393         int const vfr = _parent->film()->video_frame_rate ();
394         Frame const len = _full_length->get (vfr).frames_round (vfr);
395         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
396                 shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (i);
397                 if (ic && ic->still ()) {
398                         ic->video->set_length (len);
399                 }
400         }
401 }
402
403 void
404 TimingPanel::trim_start_changed ()
405 {
406         shared_ptr<FilmViewer> fv = _viewer.lock ();
407         if (!fv) {
408                 return;
409         }
410
411         DCPTime const ph = fv->position ();
412
413         fv->set_coalesce_player_changes (true);
414
415         shared_ptr<Content> ref;
416         optional<FrameRateChange> ref_frc;
417         optional<DCPTime> ref_ph;
418
419         Suspender::Block bl = _film_content_changed_suspender.block ();
420         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
421                 if (i->position() <= ph && ph < i->end(_parent->film())) {
422                         /* The playhead is in i.  Use it as a reference to work out
423                            where to put the playhead post-trim; we're trying to keep the playhead
424                            at the same frame of content that we're looking at pre-trim.
425                         */
426                         ref = i;
427                         ref_frc = _parent->film()->active_frame_rate_change (i->position ());
428                         ref_ph = ph - i->position() + DCPTime (i->trim_start(), ref_frc.get());
429                 }
430
431                 ContentTime const trim = _trim_start->get (i->video_frame_rate().get_value_or(_parent->film()->video_frame_rate()));
432                 i->set_trim_start (trim);
433         }
434
435         if (ref) {
436                 fv->seek (max(DCPTime(), ref_ph.get() + ref->position() - DCPTime(ref->trim_start(), ref_frc.get())), true);
437         }
438
439         fv->set_coalesce_player_changes (false);
440 }
441
442 void
443 TimingPanel::trim_end_changed ()
444 {
445         shared_ptr<FilmViewer> fv = _viewer.lock ();
446         if (!fv) {
447                 return;
448         }
449
450         fv->set_coalesce_player_changes (true);
451
452         Suspender::Block bl = _film_content_changed_suspender.block ();
453         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
454                 ContentTime const trim = _trim_end->get (i->video_frame_rate().get_value_or(_parent->film()->video_frame_rate()));
455                 i->set_trim_end (trim);
456         }
457
458         /* XXX: maybe playhead-off-the-end-of-the-film should be handled elsewhere */
459         if (fv->position() >= _parent->film()->length()) {
460                 fv->seek (_parent->film()->length() - DCPTime::from_frames(1, _parent->film()->video_frame_rate()), true);
461         }
462
463         fv->set_coalesce_player_changes (false);
464 }
465
466 void
467 TimingPanel::play_length_changed ()
468 {
469         DCPTime const play_length = _play_length->get (_parent->film()->video_frame_rate());
470         Suspender::Block bl = _film_content_changed_suspender.block ();
471         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
472                 FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ());
473                 i->set_trim_end (
474                         ContentTime (max(DCPTime(), i->full_length(_parent->film()) - play_length), frc) - i->trim_start()
475                         );
476         }
477 }
478
479 void
480 TimingPanel::video_frame_rate_changed ()
481 {
482         bool enable = true;
483         if (_video_frame_rate->GetValue() == wxT("")) {
484                 /* No frame rate has been entered; if the user clicks "set" now it would unset the video
485                    frame rate in the selected content.  This can't be allowed for some content types.
486                 */
487                 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected()) {
488                         if (
489                                 dynamic_pointer_cast<DCPContent>(i) ||
490                                 dynamic_pointer_cast<FFmpegContent>(i)
491                                 ) {
492                                 enable = false;
493                         }
494                 }
495         }
496
497         _set_video_frame_rate->Enable (enable);
498 }
499
500 void
501 TimingPanel::set_video_frame_rate ()
502 {
503         optional<double> fr;
504         if (_video_frame_rate->GetValue() != wxT("")) {
505                 fr = locale_convert<double> (wx_to_std (_video_frame_rate->GetValue ()));
506         }
507         Suspender::Block bl = _film_content_changed_suspender.block ();
508         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
509                 if (fr) {
510                         i->set_video_frame_rate (*fr);
511                 } else {
512                         i->unset_video_frame_rate ();
513                 }
514         }
515
516         _set_video_frame_rate->Enable (false);
517 }
518
519 void
520 TimingPanel::content_selection_changed ()
521 {
522         setup_sensitivity ();
523
524         film_content_changed (ContentProperty::POSITION);
525         film_content_changed (ContentProperty::LENGTH);
526         film_content_changed (ContentProperty::TRIM_START);
527         film_content_changed (ContentProperty::TRIM_END);
528         film_content_changed (ContentProperty::VIDEO_FRAME_RATE);
529 }
530
531 void
532 TimingPanel::film_changed (Film::Property p)
533 {
534         if (p == Film::VIDEO_FRAME_RATE) {
535                 update_full_length ();
536                 update_play_length ();
537         }
538 }
539
540 void
541 TimingPanel::trim_start_to_playhead_clicked ()
542 {
543         shared_ptr<FilmViewer> fv = _viewer.lock ();
544         if (!fv) {
545                 return;
546         }
547
548         shared_ptr<const Film> film = _parent->film ();
549         DCPTime const ph = fv->position().floor (film->video_frame_rate ());
550         optional<DCPTime> new_ph;
551
552         fv->set_coalesce_player_changes (true);
553
554         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
555                 if (i->position() < ph && ph < i->end(film)) {
556                         FrameRateChange const frc = film->active_frame_rate_change (i->position());
557                         i->set_trim_start (i->trim_start() + ContentTime (ph - i->position(), frc));
558                         new_ph = i->position ();
559                 }
560         }
561
562         if (new_ph) {
563                 fv->seek (new_ph.get(), true);
564         }
565
566         fv->set_coalesce_player_changes (false);
567 }
568
569 void
570 TimingPanel::trim_end_to_playhead_clicked ()
571 {
572         shared_ptr<FilmViewer> fv = _viewer.lock ();
573         if (!fv) {
574                 return;
575         }
576
577         shared_ptr<const Film> film = _parent->film ();
578         DCPTime const ph = fv->position().floor (film->video_frame_rate ());
579         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
580                 if (i->position() < ph && ph < i->end(film)) {
581                         FrameRateChange const frc = film->active_frame_rate_change (i->position ());
582                         i->set_trim_end (ContentTime(i->position() + i->full_length(film) - ph - DCPTime::from_frames(1, frc.dcp), frc) - i->trim_start());
583                 }
584         }
585 }
586
587 void
588 TimingPanel::setup_sensitivity ()
589 {
590         bool const e = !_parent->selected().empty ();
591
592         _position->Enable (e);
593         _move_to_start_of_reel->Enable (e);
594         _full_length->Enable (e);
595         _trim_start->Enable (e);
596         _trim_end->Enable (e);
597         _play_length->Enable (e);
598         _video_frame_rate->Enable (e);
599
600         shared_ptr<FilmViewer> fv = _viewer.lock ();
601         DCPOMATIC_ASSERT (fv);
602         DCPTime const ph = fv->position ();
603         bool any_over_ph = false;
604         BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
605                 if (i->position() <= ph && ph < i->end(_parent->film())) {
606                         any_over_ph = true;
607                 }
608         }
609
610         _trim_start_to_playhead->Enable (any_over_ph);
611         _trim_end_to_playhead->Enable (any_over_ph);
612 }
613
614 void
615 TimingPanel::move_to_start_of_reel_clicked ()
616 {
617         /* Find common position of all selected content, if it exists */
618
619         optional<DCPTime> position;
620         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
621                 if (!position) {
622                         position = i->position();
623                 } else {
624                         if (position.get() != i->position()) {
625                                 position.reset ();
626                                 break;
627                         }
628                 }
629         }
630
631         MoveToDialog* d = new MoveToDialog (this, position, _parent->film());
632
633         if (d->ShowModal() == wxID_OK) {
634                 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected()) {
635                         i->set_position (_parent->film(), d->position());
636                 }
637         }
638         d->Destroy ();
639 }